ㅡ.ㅡ

[K8S Event] kubernetes-event-exporter 본문

ETC

[K8S Event] kubernetes-event-exporter

ekwkqk12 2023. 10. 22. 17:34

기본적으로 Kubernetes는 이벤트 데이터를 오랜 기간 저장하지 않고, 일시적으로만 유지하는 특성때문에 api서버로부터 이벤트 데이터를 수집하여 receivers를 통해 다양한 도구(output, es, opensearch, loki 등)로 라우팅하여 가시화할 수 있다.

Helm

helm install my-release oci://registry-1.docker.io/bitnamicharts/kubernetes-event-exporter

extraEnvVars:
  - name: TZ
    value: Asia/Seoul

config:
  logLevel: info
  logFormat: json
  maxEventAgeSeconds: 10
  kubeQPS: 60
  kubeBurst: 60
  # trottlePeriod: 5

  # stdout format 지정
  receivers:
    - name: "dump"
      file:
        path: "/dev/stdout"
        layout:
          message: "{{ .Message }}"
          reason: "{{ .Reason }}"
          type: "{{ .Type }}"
          count: "{{ .Count }}"
          firstTimestamp: "{{ .FirstTimestamp }}"
          lastTimestamp: "{{ .LastTimestamp }}"
          involvedObject_kind: "{{ .InvolvedObject.Kind }}"
          involvedObject_name: "{{ .InvolvedObject.Name }}"
          involvedObject_namespace: "{{ .InvolvedObject.Namespace }}"
          namespace: "{{ .Namespace }}"
          source_component: "{{ .Source.Component }}"
          host: "{{ .Source.Host }}"

  # 특정 이벤트 삭제
  route:
    routes:
      - match:
          - receiver: "dump"
        drop:
          ## AND 조건
          - type: 'Normal'
            reason: 'Completed'
            source_component: 'job-controller'
          - type: 'Normal'
            source_component: 'cronjob-controller'
            reason: 'SawCompletedJob'
          - type: 'Normal'
            source_component: 'job-controller'
            reason: 'SuccessfulCreate'
          - type: 'Normal'
            source_component: 'ingress'
            reason: 'SuccessfullyReconciled'
          - type: 'Normal'
            source_component: 'kubelet'
            message: 'already'
          ## OR 조건
          # - type: "Normal"
          # - reason: "Completed"
          # - source_component: "job-controller"

resources:
  limits:
     cpu: 400m
     memory: 250Mi
  requests:
     cpu: 100m
     memory: 25Mi

metrics:
  enabled: true
  serviceMonitor:
    enabled: true
  prometheusRule:
    enabled: true

Refference

  • https://grafana.com/grafana/dashboards/17882-kubernetes-event-exporter/
  • https://github.com/resmoio/kubernetes-event-exporter

'ETC' 카테고리의 다른 글

[ETC] eBPF  (0) 2023.12.23
[K8S Resource] ClusterAutoScaler  (0) 2023.10.22
[K8S Resource] Goldilocks  (0) 2023.10.22
[K8S Resource] Descheduler  (0) 2023.10.22
[AWS] EFS  (0) 2021.10.21