# Module: kubernetes
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/8.19/metricbeat-module-kubernetes.html

# Node metrics, from kubelet:
- module: kubernetes
  #metricsets:
  #  - node
  #  - system
  #  - pod
  #  - container
  #  - volume
  period: 10s
  hosts: ["localhost:10250"]
  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  ssl.certificate_authorities:
    - /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
  #username: "user"
  #password: "secret"

  # Enriching parameters:
  #add_metadata: true
  # If kube_config is not set, KUBECONFIG environment variable will be checked
  # and if not present it will fall back to InCluster
  #kube_config: ~/.kube/config
  #include_labels: []
  #exclude_labels: []
  #include_annotations: []
  #labels.dedot: true
  #annotations.dedot: true

  # When used outside the cluster:
  #node: node_name

  # Set the namespace to watch for resources
  #namespace: staging

  # To configure additionally node and namespace metadata `add_resource_metadata` can be defined.
  # By default all labels will be included while annotations are not added by default.
  # add_resource_metadata:
  #   namespace:
  #     include_labels: ["namespacelabel1"]
  #   node:
  #     include_labels: ["nodelabel2"]
  #     include_annotations: ["nodeannotation1"]
  #   deployment: false
  #   cronjob: false
  # Kubernetes client QPS and burst can be configured additionally
  #kube_client_options:
  #  qps: 5
  #  burst: 10

# State metrics from kube-state-metrics service:
#- module: kubernetes
#  metricsets:
#    - state_node
#    - state_deployment
#    - state_replicaset
#    - state_statefulset
#    - state_pod
#    - state_container
#    - state_job
#    - state_cronjob
#    - state_resourcequota
#    - state_service
#    - state_persistentvolume
#    - state_persistentvolumeclaim
#    - state_storageclass
#  period: 10s
#  hosts: ["kube-state-metrics:8080"]
#  add_metadata: true

# Kubernetes Events
#- module: kubernetes
#  enabled: true
#  metricsets:
#    - event
#  period: 10s
#  # Skip events older than Metricbeat's statup time is enabled by default.
#  # Setting to false the skip_older setting will stop filtering older events.
#  # This setting is also useful went Event's timestamps are not populated properly.
#  skip_older: false
#  # If kube_config is not set, KUBECONFIG environment variable will be checked
#  # and if not present it will fall back to InCluster
#  kube_config: ~/.kube/config
#  # Set the namespace to watch for events
#  namespace: staging
#  # Set the sync period of the watchers
#  sync_period: 10m
#  # Kubernetes client QPS and burst can be configured additionally
#  kube_client_options:
#    qps: 5
#    burst: 10
