
OpenTelemetry on Kubernetes: deploy node, cluster, and identity in that order
By Nicolas Narbais
How to split node-local and cluster-wide OpenTelemetry Collectors on Kubernetes with Helm, explicit OTLP export to a backend.
You install the OpenTelemetry Collector Helm chart, see the Pods enter Running, and assume Kubernetes is observable. It is not.
Match your Collector topology to where each signal actually lives:
- DaemonSet for node-local metrics, container logs, and local OTLP reception.
- Single active Deployment for cluster-wide API state and Kubernetes events.
- Workload identity verified at the node layer before network hops obscure the sender.
- Optional gateway only when you can name the shared policy or egress boundary it owns.
Pinned versions: Examples below use the opentelemetry-collector Helm chart 0.167.0 (Collector 0.157.0) with the opentelemetry-collector-k8s image.
Match Collector shape to where each signal lives
The Helm chart gives you a workload and a default pipeline. It does not decide where signals exist, how they reach your backend, or whether they stay linked to the workload that emitted them. Check the OpenTelemetry component deployment matrix before enabling extra receivers.
| Signal locality | Receivers / sources | Collector shape |
|---|---|---|
| Node-local | kubeletstats, hostmetrics, filelog, local OTLP | DaemonSet (one per node) |
| Cluster-wide | k8s_cluster, Kubernetes events, API objects | Deployment (one active owner) |
| Application-emitted | SDK traces, metrics, logs | Sent to node-local OTLP receiver |
Run a DaemonSet for node-local data
A DaemonSet places one Collector on every eligible node, giving direct access to kubelet stats, host metrics, local container log files, and local application OTLP traffic.
# values-agent.yaml
# chart 0.167.0, Collector 0.157.0
mode: daemonset
image:
repository: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s
presets:
kubeletMetrics:
enabled: true
logsCollection:
enabled: true
kubernetesAttributes:
enabled: true
hostNetwork: true
service:
enabled: false
ports:
otlp:
hostPort: null
otlp-http:
hostPort: null
jaeger-compact:
enabled: false
jaeger-thrift:
enabled: false
jaeger-grpc:
enabled: false
zipkin:
enabled: false
extraEnvsFrom:
- secretRef:
name: otel-backend-credentials
config:
receivers:
jaeger: null
zipkin: null
kubeletstats:
insecure_skip_verify: true
exporters:
debug: null
otlp_http:
endpoint: ${env:BACKEND_OTLP_ENDPOINT}
headers:
authorization: ${env:BACKEND_API_KEY}
service:
pipelines:
traces:
receivers: [otlp]
exporters: [otlp_http]
metrics:
exporters: [otlp_http]
logs:
exporters: [otlp_http]
Two Helm behaviors break configs silently: Setting a component to null deletes it, so you must remove it from every default pipeline that references it. Helm also replaces YAML lists instead of merging them, so if you override a pipeline list, spell out the complete list.
Put memory_limiter before k8s_attributes and batch
With kubernetesAttributes enabled, the chart can render k8s_attributes ahead of memory_limiter. Override the processor order so backpressure runs before allocations while Kubernetes enrichment still runs before batch discards per-connection context:
config:
service:
pipelines:
traces:
processors: [memory_limiter, k8s_attributes, batch]
metrics:
processors: [memory_limiter, k8s_attributes, batch]
logs:
processors: [memory_limiter, k8s_attributes, batch]
Verify kubelet TLS instead of assuming it works
On the test cluster used here, the kubelet served a certificate the Collector did not trust. The Collector Pod stayed Running, health checks stayed green, RBAC was valid, and kubelet metrics never arrived.
config:
receivers:
kubeletstats:
insecure_skip_verify: true
Do not copy insecure_skip_verify: true blindly into production. Many managed clusters present trusted certificates. Verify that kubelet metrics actually land in your backend rather than trusting Pod status.
Bind only the OTLP ports you need
If you want narrower host exposure than hostNetwork: true, expose only ports 4317 and 4318:
mode: daemonset
hostNetwork: false
service:
enabled: false
ports:
otlp:
enabled: true
containerPort: 4317
hostPort: 4317
otlp-http:
enabled: true
containerPort: 4318
hostPort: 4318
Point workloads to their own node IP and inject k8s.pod.uid via the Downward API so pod association does not depend on source IP preservation:
env:
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://$(NODE_IP):4318
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(POD_UID)
Run one active Deployment for cluster state
A node Collector cannot report Pending Pods or NotReady nodes. That state lives in the Kubernetes API. The k8s_cluster receiver needs one active owner per cluster so replicas do not emit duplicate cluster metrics.
# values-cluster.yaml
# chart 0.167.0, Collector 0.157.0
mode: deployment
replicaCount: 1
image:
repository: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s
presets:
clusterMetrics:
enabled: true
kubernetesEvents:
enabled: true
extraEnvsFrom:
- secretRef:
name: otel-backend-credentials
config:
exporters:
debug: null
otlp_http:
endpoint: ${env:BACKEND_OTLP_ENDPOINT}
headers:
authorization: ${env:BACKEND_API_KEY}
service:
pipelines:
traces:
exporters: [otlp_http]
metrics:
exporters: [otlp_http]
logs:
exporters: [otlp_http]
The traces override is mandatory: removing the default debug exporter requires updating every default pipeline that references it, or the Collector fails to start.
Keep kubeletMetrics and logsCollection off this Deployment. It runs on one node and would report one node’s data under a cluster-wide name. Workload association also stays at the node layer because cluster-state records already carry Kubernetes object identity from the API.
If you run more than one replica for availability, enable leader election so only one replica actively scrapes cluster state:
Prove workload identity before adding more topology
The k8s_attributes processor enriches telemetry only after associating it with a Pod, either from a resource attribute (Pod IP or UID) or from the incoming connection address. Connection-based association breaks as soon as traffic hops through another Collector or proxy.
| Signal path | How Pod identity is resolved |
|---|---|
Container log files (filelog) | Parsed from the Kubernetes log file path on disk |
| App OTLP to node DaemonSet | Source IP or explicit k8s.pod.uid attribute |
| Telemetry forwarded to a gateway | Must be attached at the node Collector first; the gateway sees the agent’s IP |
| Sidecar Collector | Inject known identity via the Downward API; do not guess sibling containers |
Pick one real workload and verify that a representative trace, metric, and log all share service.name, environment, namespace, Pod name or UID, owning workload (Deployment/StatefulSet), and node name. If those records cannot join, incidents turn into guesswork.
Add a gateway only when it owns a real job
Everything above exports cleanly without a gateway. Introduce a gateway Deployment only when you need one of these centralized responsibilities:
- Shared policy across teams: redaction, filtering, or routing managed in one pipeline.
- One egress and credential boundary: backend tokens and outbound rules live in one place instead of on every node.
- Tail-based sampling: requires trace-ID routing so every span of a trace reaches the same gateway replica.
Non-negotiable rule: Attach workload identity at the node Collector before forwarding to a gateway. Gateway replica count is a throughput choice and stays separate from the single-active-owner rule for k8s_cluster.
Five checks that catch a broken baseline early
Start offline by rendering the chart and checking that every component named in a pipeline is defined:
helm template otel-agent open-telemetry/opentelemetry-collector \
--version 0.167.0 \
-f values-agent.yaml
Then verify five things against the running cluster:
- Node coverage: Confirm every intended node runs a DaemonSet Pod, accounting for taints and tolerations.
- Cluster-state uniqueness: Confirm exactly one
k8s_clusterreceiver is active (or leader-elected). - Backend delivery: Prove one trace, one metric, and one log reach the backend; Pod
Runningstatus proves nothing about export. - Workload association: Confirm that trace, metric, and log from one workload share the same Kubernetes and service identity.
- Optional feature scope: When adding object watches or discovery rules later, verify they capture only the resources you intended.
If a signal vanishes inside a proven topology, isolate the broken hop locally with a Docker Compose Collector lab. Run helm template on your current cluster values today and check processor order and duplicate cluster receivers before adding a single new dashboard.
Sources
Written by
Nicolas Narbais
Nicolas Narbais builds, breaks, debugs, and scales observability systems using OpenTelemetry and modern telemetry pipelines. He shares practical, opinionated lessons to help engineers get better signal with less noise.
Olatuak Editorial Philosophy
Better signal, not more telemetry.
Olatuak helps platform engineers, SREs, and observability teams turn noisy telemetry into clear operational decisions without blindly collecting more data.
