Kubernetes module
editKubernetes module
editThis 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
editThe Kubernetes module is tested with Kubernetes 1.13.x and 1.14.x
Dashboard
editKubernetes 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:
Kubernetes scheduler example:
Kubernetes proxy example:
Example configuration
editThe Kubernetes module supports the standard configuration options that are described in Modules. Here is an example configuration:
metricbeat.modules:
# Node metrics, from kubelet:
- module: kubernetes
metricsets:
- container
- node
- pod
- system
- volume
period: 10s
enabled: true
hosts: ["https://${HOSTNAME}:10250"]
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
ssl.verification_mode: "none"
#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
# When used outside the cluster:
#host: node_name
# 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
# State metrics from kube-state-metrics service:
- module: kubernetes
enabled: true
metricsets:
- state_node
- state_deployment
- state_replicaset
- state_statefulset
- state_pod
- state_container
- state_cronjob
- state_resourcequota
- state_service
- state_persistentvolume
- state_persistentvolumeclaim
period: 10s
hosts: ["kube-state-metrics:8080"]
# Enriching parameters:
add_metadata: true
# When used outside the cluster:
#host: node_name
# 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
# 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 SSL.
It also supports the options described in Standard HTTP config options.
Metricsets
editThe following metricsets are available: