OpenTelemetry Collector configs for Kubernetes (8)
On Kubernetes the collector usually runs twice: as a DaemonSet on every node for pod logs and kubelet metrics, and as a single deployment for cluster-level metrics and events. Both need the right RBAC and the right pod metadata on every record.
The configs below cover pod logs, cluster, kubelet and cAdvisor metrics, Kubernetes events and k8sattributes enrichment, each as a validated file. For the RBAC and association details of k8sattributes, and for how the layers fit together, see the two guides linked here.
Collect Kubernetes pod logs (DaemonSet)
Every container's logs from every node, with namespace, pod and container read from the log path - one DaemonSet, no sidecars.
Logs
Get the config →Collect node, pod and container metrics from the kubelet
CPU, memory, filesystem and network for every node, pod and container, read from the kubelet on each node.
Metrics
Get the config →Collect Kubernetes cluster metrics (one replica)
Deployment replicas, pod phases, node conditions, restarts and resource quotas from the Kubernetes API - one collector for the whole cluster.
Metrics
Get the config →Collect Kubernetes events as logs
Scheduling failures, image pull errors, OOM kills and probe failures as log records - kept after Kubernetes deletes the events.
Logs
Get the config →Scrape cAdvisor container metrics from the kubelet
The container_* metrics Kubernetes dashboards expect, scraped from each node's kubelet with the pod's service account token.
Metrics
Get the config →Scrape pods by prometheus.io annotations
Scrape every pod that asks for it with prometheus.io/scrape annotations, each node's collector only its own pods.
Metrics
Get the config →Add Kubernetes pod, namespace and deployment to telemetry
Tag every log, metric and span with the namespace, pod, deployment and node it came from.
Logs · Metrics · Traces
Get the config →Kubernetes pod logs to Loki, enriched with deployment and cluster
Every pod's logs into Loki over OTLP, labelled with namespace, pod, container, deployment, node and cluster.
Logs
Get the config →