ABOUT ME

-

  • EFK Stack 구성하기 (with Atlassian)
    Kubernetes 2025. 3. 23. 21:21

    EFK 스택이란?

    https://www.researchgate.net/figure/EFK-stack-on-Kubernetes_fig4_384455176

    EFK 스택은 Kubernetes에서 널리 사용되는 로깅 시스템으로, Elasticsearch, Fluentd, Kibana로 구성됩니다.

    • Fluentd: 다양한 소스에서 로그 데이터를 수집·집계한 후 여러 대상으로 전송하는 오픈소스 로그 프로세서입니다.
    • Elasticsearch: 대용량 데이터를 빠르게 검색·분석할 수 있는 분산형 검색 및 분석 엔진입니다.
    • Kibana: Elasticsearch에 저장된 데이터를 검색하고 시각화할 수 있는 오픈소스 대시보드 도구입니다.

     

     

     

     

    ECK 설치

    ECK Operator

    ECK Operator는 Kubernetes에서 Elasticsearch, Kibana, APM Server 등의 리소스를 생성하고 관리할 수 있도록 해주는 컨트롤러로, Elastic이 제공하는 Kubernetes Operator입니다.

    • 저장소 추가 및 차트 다운로드
    helm repo add elastic https://helm.elastic.co
    helm repo update
    
    helm pull elastic/eck-operator
    tar xvf eck-operator-2.16.1.tgz

     

     

    • 글로벌 설치
      • 기본 설치 모드이며 독립 실행형 YAML 매니페스트를 사용하여 ECK를 설치하는 것과 동일
    helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace

     

     

     

    ECK Stack

    ECK Stack은 Elastic Stack(Elasticsearch, Kibana, APM Server 등)의 배포를 도와주는 Helm 차트이며, ECK Operator가 이를 관리합니다.
    이 차트를 사용하기 전에 Elastic ECK Operator를 Kubernetes 클러스터에 설치해야 합니다.

    • 현재 지원하는 리소스
      • Elasticsearch
      • Kibana
      • Elastic Agent
      • Fleet Server
      • Beats
      • Logstash
      • APM Server

     

    • values 구성
      • 테스트를 위해 https 임시로 disable
    eck-elasticsearch:
      enabled: true
      fullnameOverride: elasticsearch
      http:
        tls:
          selfSignedCertificate:
            disabled: true
      ingress:
        enabled: true
        annotations: {}
        className: nginx
        pathType: Prefix
        hosts:
          - host: es.hyun.com
            path: /
        tls:
          enabled: false
    
    eck-kibana:
      enabled: true
      elasticsearchRef:
        name: elasticsearch
      http:
        tls:
          selfSignedCertificate:
            disabled: true
      ingress:
        enabled: true
        annotations: {}
        className: nginx
        pathType: Prefix
        hosts:
          - host: kibana.hyun.com
            path: /
        tls:
          enabled: false

     

     

    • 설치
    helm install elastic-stack elastic/eck-stack -n elastic-stack --create-namespace

     

     

     

    접속 확인

    • 비밀번호 확인 (operator에 의해 자동 생성됨)
    # ES
     kubectl get secret elasticsearch-es-elastic-user -n elastic-stack -o go-template='{{.data.elastic | base64decode }}'
     
     # Kibana
     kubectl get secret elastic-stack-eck-kibana-kb-config -n elastic-stack -o jsonpath='{ .data.kibana\.yml }' | base64 --decode | grep -A1 encryptedSavedObjects

     

    • ES

     

    • Kibana

     

     

     

     

    Atlassian 솔루션 Fluentd 사이드카 활성화

    • values에 fluentd 활성화 추가
      • 내부 통신 사용 → es-http 서비스를 hostname으로 등록
      • es 8.x 버전부터 인증 필수
        → Jira 차트에 es ID/PW 변수 받는 값이 없어서 custom config로 구성
        (jira 차트는 es 7.x 기준)
    fluentd:
      enabled: true
      customConfigFile: true
      fluentdCustomConfig:
        fluent.conf: |
          <source>
            @type http
            port 9880
            bind 0.0.0.0
          </source>
          <filter **>
            @type record_transformer
            <record>
              podname "#{ENV['POD_NAME']}"
              podnamespace "#{ENV['POD_NAMESPACE']}"
              podip "#{ENV['POD_IP']}"
              helmrelease "#{ENV['HELM_RELEASE_NAME']}"
            </record>
          </filter>
          <filter **>
            @type grep
            <exclude>
              key log
              pattern /Detected ES 8/
            </exclude>
          </filter>
          <filter **>
            @type stdout
          </filter>
          <match **>
            @type elasticsearch
            host elasticsearch-es-http.elastic-stack.svc
            user elastic
            password CHhC25w705a7vKIjz9OUh875
            logstash_format true
            logstash_prefix jira
          </match>

     

     

     

     

    로그 수집 확인

    • Kibana 접속
      • Discover → View 생성

     

     

     

     

    Reference

    'Kubernetes' 카테고리의 다른 글

    ArgoCD를 이용한 GitOps 구성  (0) 2025.03.23
    Prometheus & Grafana - 2) 설치하기  (0) 2025.03.23
    Prometheus & Grafana - 1) 개요  (0) 2025.03.23
    CloudNativePG  (0) 2025.03.23
    ArgoCD 설치 (Helm)  (0) 2025.03.23
Designed by Tistory.