Public documentation
Documentation indexRead as MarkdownKubernetes
This recipe installs a Collector DaemonSet for Linux nodes. It accepts application OTLP, adds Kubernetes metadata, gathers kubelet metrics, and tails pod logs. Applications still need language instrumentation to create request spans.
The example uses OpenTelemetry Collector Helm chart 0.173.1 and Contrib image 0.160.0. The chart's presets supply the corresponding receivers, mounts, and RBAC. Keep the chart and image versions together when reproducing this configuration.
Prerequisites
Use a cluster where you can install a DaemonSet, its ServiceAccount/RBAC, and the required log mounts. Some managed or serverless node environments restrict host access or kubelet endpoints; use an application OTLP gateway in those environments and obtain node telemetry through supported provider interfaces.
You need Helm 3 or a compatible Helm release, kubectl targeting the intended cluster, and a Corridora ingest credential. Allow Collector egress to the Kubernetes API, kubelets, DNS, and the Corridora HTTPS endpoint. Restrict receiver access to intended workloads with your cluster network policy.
Prepare values and credentials
Save kubernetes-values.yaml locally. Replace replace-with-your-cluster-name with a stable name. The Collector uses the cluster's ServiceAccount CA to verify the kubelet; if your kubelet serving certificate uses another issuer, mount its trusted CA and change ca_file. The address used to connect must also match its certificate.
Create an observability namespace or use your existing one consistently. Load the endpoint and key using common settings. Create the Secret without placing the literal key in the command arguments:
kubectl create namespace observability --dry-run=client -o yaml | kubectl apply -f -
secret_dir="$(mktemp -d)"
chmod 700 "$secret_dir"
printf '%s' "$CORRIDORA_OTLP_ENDPOINT" > "$secret_dir/endpoint"
printf '%s' "$CORRIDORA_INGEST_KEY" > "$secret_dir/ingest-key"
chmod 600 "$secret_dir/endpoint" "$secret_dir/ingest-key"
kubectl -n observability create secret generic corridora-otel \
--from-file=endpoint="$secret_dir/endpoint" \
--from-file=ingest-key="$secret_dir/ingest-key" \
--dry-run=client -o yaml | kubectl apply -f -
rm -f "$secret_dir/endpoint" "$secret_dir/ingest-key"
rmdir "$secret_dir"
Use your managed secret integration instead if one is already established. Restrict Kubernetes access to this Secret; encoding a value in a Secret is not itself encryption or access control. Do not commit generated Secret YAML.
Render, review, and install
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update open-telemetry
helm template corridora-otel open-telemetry/opentelemetry-collector \
--version 0.173.1 --namespace observability \
--values kubernetes-values.yaml > rendered.yaml
helm upgrade --install corridora-otel open-telemetry/opentelemetry-collector \
--version 0.173.1 --namespace observability \
--values kubernetes-values.yaml --wait --timeout 5m
Review the rendered configuration, ClusterRole, log mounts, and Service before installation. This example creates a private ClusterIP Service and disables host ports and unused Jaeger/Zipkin listeners. It does not install an internet-facing receiver.
Check the rollout:
kubectl -n observability rollout status daemonset/corridora-otel
kubectl -n observability get pods -l app.kubernetes.io/instance=corridora-otel -o wide
kubectl -n observability logs -l app.kubernetes.io/instance=corridora-otel --tail=100 --prefix
The node-local Service requires a ready Collector on the calling workload's node. Add appropriate tolerations if application workloads run on tainted nodes, or use a separate gateway for nodes that cannot host this DaemonSet. A healthy pod on a different node does not satisfy local routing.
Configure application pods
Merge these entries into the instrumented application's container environment:
env:
- name: OTEL_SERVICE_NAME
value: checkout-api
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://corridora-otel.observability.svc.cluster.local:4318
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: OTEL_RESOURCE_ATTRIBUTES
value: service.namespace=commerce,deployment.environment.name=staging,k8s.pod.uid=$(OTEL_POD_UID)
This is a pod-spec fragment, not an entire Deployment. The application SDK must support these settings or receive their equivalents in code. OTEL_POD_UID is a custom helper variable expanded by Kubernetes into the later resource setting. Including the pod UID helps metadata association; keep the order shown.
The application does not need the Corridora key when sending to this private receiver. Protect the receiver through cluster network policy or configure authenticated intake for less trusted senders.
Understand what the presets collect
- Kubernetes attributes enrich associated telemetry with pod, namespace, and node metadata. They do not instrument application code.
- Kubelet collection emits node, pod, and container measurements from each node. Errors such as certificate failure,
403, or timeout indicate a collection gap even if OTLP intake still works. - Pod log collection reads new container log entries using the container-format parser and excludes this Collector's own logs. It does not automatically turn trace IDs embedded in application text into log correlation fields.
This DaemonSet does not enable host filesystem metrics, Kubernetes events, or cluster-wide state metrics. It does not persist log offsets or exporter queues, so test restart and outage behavior before relying on delivery continuity.
Optional cluster state and events
Use kubernetes-lifecycle.yaml to deploy a
separate, single-replica Collector. k8s_cluster reads desired and available
workload counts, Pod phases, container readiness/restarts, and recorded state
reasons. k8s_events watches Kubernetes Events. The Deployment uses Recreate
to avoid two overlapping watchers during an update. Run one such Deployment per
cluster, and leave the DaemonSet responsible for node-local usage and Pod logs.
Review the manifest and set its cluster name, service namespace, and deployment
environment. Use the same k8s.cluster.name as the DaemonSet and matching
service.namespace and deployment.environment.name on any measurements you
intend to join. Keep the Secret in the Deployment's namespace and include the
kubernetes-state service in the Corridora project if using a project filter.
Use this cluster-wide recipe for a cluster with a single intended deployment
scope. For mixed ownership, use the documented namespace restrictions and
namespace Roles/RoleBindings for each approved scope instead, and disclose the
loss of node/cluster-scoped observations. The example grants this service
account read access to listed resources, including Events and workloads.
Review access to event messages before exporting cluster-wide logs.
For a single deployment scope, add the corresponding default attributes to
config.processors.resource/cluster.attributes in the DaemonSet values. Keep
its existing cluster-name entry. Use insert so application-provided scope is
preserved, and substitute the values configured in the lifecycle Deployment.
- key: service.namespace
value: commerce
action: insert
- key: deployment.environment.name
value: staging
action: insert
kubectl apply --dry-run=server -f kubernetes-lifecycle.yaml
kubectl apply -f kubernetes-lifecycle.yaml
kubectl -n observability rollout status deployment/corridora-kubernetes-state
Find k8s.deployment.available, k8s.deployment.desired, and
k8s.container.restarts under kubernetes-state. For a controlled test
workload, inspect the known deployment's readiness and create a Pod event you
can compare with kubectl describe. A k8s.event log should retain its reason
and object UID. Open the matching resource in Infrastructure and verify the
recorded event timestamp. Recreating a same-named Pod creates a new object UID.
Pod events attach to the Pod. A field path identifies a logical container slot.
Use a runtime container ID to match a specific historical container instance.
The k8s_events receiver is alpha in Collector Contrib 0.160.0. Event history
is bounded by the Kubernetes API and the selected Corridora interval. The
example throttles recurring Event updates and keeps watch state and export queues
in memory. Treat each reported recurrence count as a snapshot and missing events
as a collection gap. See the pinned Kubernetes cluster receiver
and Kubernetes events receiver
documentation for RBAC and collector behavior.
Verify
Generate a real application request and locate its trace under the application service. Inspect k8s.pod.uid, pod/namespace metadata, and the cluster name. Then clear service filters and find metrics such as k8s.node.cpu.usage, k8s.pod.cpu.usage, and container memory measurements from the kubelet path.
Write a new application log entry and find it in Logs. If you also export that same log through the SDK, choose which path to retain or explicitly filter duplicates.
Inspect all Collector pods, not just the first, when checking scrape and permission failures. For a rollout acceptance test, use verification and test at least one workload on each node class.
Rotating the Secret does not update environment variables inside already running pods. After updating it, restart the DaemonSet through a controlled rollout and verify export resumes from every node.