Kubernetes moduleedit

This module fetches metrics from Kubernetes kubelet agent and kube-state-metrics service.

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.

Compabilityedit

The Kubernetes module is tested with Kubernetes 1.8.0, 1.9.4 and 1.10.0.

Example configurationedit

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
- module: kubernetes
  enabled: true
  metricsets:
    - apiserver
  hosts: ["https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"]

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.

Metricsetsedit

The following metricsets are available: