kubernetes-event-exporter

云原生监控exporter约 261 字小于 1 分钟

kubernetes-event-exporter 是一个用于采集k8s事件的工具,通过它可以将 Kubernetes 事件导出到第三方平台或者数据库(如Webhooks/HTTP,Elasticsearch,OpenSearch,Kafka,Slack,File,Loki等),以便用于可观察性或警报目的。

服务配置

image:
  registry: docker.io
  repository: bitnami/kubernetes-event-exporter
  tag: 1.6.1-debian-12-r16

config:
  logLevel: debug
  metricsNamePrefix: 'event_exporter_'
  # 修改为json,便于数据操作
  logFormat: json
  # https://github.com/resmoio/kubernetes-event-exporter#configuration
  receivers:
    # - name: "dump"
    #   file:
    #     path: "/dev/stdout"
    #     layout: {}
    - name: "loki"
      loki:
        # 地址根据实际情况修改
        url: http://grafana-loki-distributor.middleware:3100/loki/api/v1/push
        headers:
          Content-Type: application/json
          User-Agent: "kube-event-exporter"
        streamLabels:
          app: kubernetes-event-exporter
          dataCenter: local-cluster
          source: event-exporter
        # 这里不建议修改了,汇总和模板冲突。如自定义大屏的话,可按需配置
        # layout: {}

  route:
    routes:
      - match:
          # - receiver: "dump"
          - receiver: "loki"
metrics:
  enabled: true
  serviceMonitor:
    enabled: true

  prometheusRule:
    enabled: false


大屏导入

导入过程略,大屏模版如下

https://grafana.com/grafana/dashboards/17882-kubernetes-event-exporter/open in new window

event生成

模拟动作,出发事件,查看效果

kubectl create deploy event-test --image=nginx-bad