Kubernetes module

edit

This module fetches metrics from Kubernetes several components:

All metricsets with the state_ prefix require hosts field pointing to kube-state-metrics service within the cluster, while the rest should be pointed to kubelet service. Check the example configuration on how to do it.

The default metricsets are container, node, pod, system and volume.

Compatibility

edit

The Kubernetes module is tested with Kubernetes 1.13.x and 1.14.x

Dashboards for scheduler and proxy are not compatible with kibana versions below 7.2.0

Dashboard

edit

Kubernetes module is shipped including default dashboards for apiserver, controllermanager, scheduler and proxy.

If you are using HA for those components, be aware that when gathering data from all instances the dashboard will usually show and average of the metrics. For those scenarios filtering by hosts or service address is possible.

Dashboards for controllermanager scheduler and proxy are not compatible with kibana versions below 7.2.0

Kubernetes controller manager example:

metricbeat kubernetes controllermanager

Kubernetes scheduler example:

metricbeat kubernetes scheduler

Kubernetes proxy example:

metricbeat kubernetes proxy

Example configuration

edit

The Kubernetes module supports the standard configuration options that are described in Specify which modules to run. Here is an example configuration:

metricbeat.modules:
# Node metrics, from kubelet:
- module: kubernetes
  metricsets:
    - container
    - node
    - pod
    - system
    - volume
  period: 10s
  hosts: ["localhost:10255"]
  enabled: true
  #bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  #ssl.certificate_authorities:
  #  - /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
  #ssl.certificate: "/etc/pki/client/cert.pem"
  #ssl.key: "/etc/pki/client/cert.key"

  # Enriching parameters:
  add_metadata: true
  in_cluster: true
  # When used outside the cluster:
  #host: node_name
  #kube_config: ~/.kube/config

# State metrics from kube-state-metrics service:
- module: kubernetes
  enabled: true
  metricsets:
    - state_node
    - state_deployment
    - state_replicaset
    - state_statefulset
    - state_pod
    - state_container
  period: 10s
  hosts: ["kube-state-metrics:8080"]

  # Enriching parameters:
  add_metadata: true
  in_cluster: true
  # When used outside the cluster:
  #host: node_name
  #kube_config: ~/.kube/config

# Kubernetes events
- module: kubernetes
  enabled: true
  metricsets:
    - event

# Kubernetes API server
# (when running metricbeat as a pod)
- module: kubernetes
  enabled: true
  metricsets:
    - apiserver
  hosts: ["https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"]

# Kubernetes proxy server
# (when running metricbeat locally at hosts or as a daemonset + host network)
- module: kubernetes
  enabled: true
  metricsets:
    - proxy
  hosts: ["localhost:10249"]
  period: 10s

# Kubernetes controller manager
# (URL and deployment will need to be modified to match the controller manager deployment)
- module: kubernetes
  enabled: true
  metricsets:
    - controllermanager
  hosts: ["http://localhost:10252"]
  period: 10s

# Kubernetes scheduler
# (URL and deployment method will need to be adapted to match scheduler deployment)
- module: kubernetes
  enabled: true
  metricsets:
    - scheduler
  hosts: ["localhost:10251"]
  period: 10s

This module supports TLS connections when using ssl config field, as described in Specify SSL settings. It also supports the options described in Standard HTTP config options.

Metricsets

edit

The following metricsets are available: