Skip to content

tmax-cloud/efk-operator

Repository files navigation

efk-operator

Prerequisite

Step 0. kustomize 및 적용

  • 목적 : yaml 파일 생성 및 적용을 위한 kustomize 실행
  • 순서 :
    $ kustomize build config/default/ | kubectl apply -f -
  • 비고 :

Flow

  1. 유저가 fluentbitconfiguration 리소스를 생성
  2. efk-operator가 이를 감지하고 그에 해당하는 configmap 생성
  3. injection 하고싶은 리소스에 아래와 같이 두 가지 label을 추가
  • log-collector: enbaled
  • tmax.io/log-collector-configuration: {생성된 configmap 이름}
  1. 해당 리소스 생성시, hypercloud-api-server의 webhook 의해 sidecar injection 됨

예시

  • fluentbitconfiguration
    apiVersion: config.tmax.io/v1alpha1
    kind: FluentBitConfiguration
    metadata:
      name: fbc-test
      namespace: kube-logging
    spec:
      inputPlugins:
      - path: /test/log/
        pattern: "*.log"
        tag: testtag
      filterPlugins:
      - parserName: parser
        regex: .*
        tag: testtag
      outputPlugins:
      - indexName: testtag_prefix
        tag: testtag
  • injection for pod
    apiVersion: v1
    kind: Pod
    metadata:
      name: counter
      namespace: kube-logging
      labels:
        log-collector: enabled
        tmax.io/log-collector-configuration: fbc-test
    spec:
      containers:
      - name: count
        image: busybox
        imagePullPolicy: IfNotPresent
        args: [/bin/sh, -c, 'i=0; while true; do echo "$(date)" && sleep 10; i=$(i+1)); done']
        env:
        - name: FLUENT_ELASTICSEARCH_HOST
          value: "elasticsearch.kube-logging.svc.cluster.local"
        - name: FLUENT_ELASTICSEARCH_PORT
          value: "9200"
        - name: FLUENT_ELASTICSEARCH_SCHEME
          value: "http" 
  • injection for deployment
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: counter-deploy
      namespace: kube-logging
      labels:
        log-collector: enabled
        tmax.io/log-collector-configuration: fbc-test
    spec:
      replicas: 1
      selector:
        matchLabels:
          kube-logging: injection-test
      template:
        metadata:
          name: counter
          namespace: kube-logging
          labels:
            kube-logging: injection-test
        spec:
          containers:
          - name: count
            image: busybox
            imagePullPolicy: IfNotPresent
            args: [/bin/sh, -c, 'i=0; while true; do echo "$(date)" && sleep 10; i=$((i+1)); done']
            env:
            - name: FLUENT_ELASTICSEARCH_HOST
              value: "elasticsearch.kube-logging.svc.cluster.local"
            - name: FLUENT_ELASTICSEARCH_PORT
              value: "9200"
            - name: FLUENT_ELASTICSEARCH_SCHEME
              value: "http"

참고

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published