OTel Kubernetes Integration
Overview
The OTel Collector on Kubernetes runs as a DaemonSet (one pod per node) and collects:
-
Traces — received from instrumented pods over OTLP gRPC (4317) or OTLP HTTP (4318)
-
Metrics — node, pod, container, and volume metrics via
kubelet_stats; host CPU, memory, and disk viahostmetrics; cluster-level metrics such as deployment and node conditions viak8s_cluster -
Logs — container log files tailed from each node
-
Kubernetes events — pod scheduling, node conditions, and deployment changes via the
k8s_eventsreceiver -
Infrastructure objects — pod, deployment, and node metadata via the
k8s_objectsreceiver
All telemetry is exported to Kloudfuse over OTLP HTTP. Each record is tagged with the cluster name when it is detected or you set it, and with cloud account attributes when the Collector runs on a cloud that provides them; on-premises clusters get no cloud account attributes. The Helm chart manages RBAC, service accounts, and ConfigMap generation automatically.
The Collector runs as a DaemonSet, so the cluster needs nodes that can run DaemonSet pods. EKS Fargate does not run DaemonSets, so this procedure does not support clusters that run only on Fargate; the cluster needs EC2 nodes.
Kloudfuse publishes a complete, commented values file for the OpenTelemetry Collector Helm chart: helm-values.yaml.
It works on GKE, EKS, AKS, and other Kubernetes clusters, and needs only your Kloudfuse hostname, an API key, and, outside the managed clouds, a cluster name.
The rest of this page explains what the file does and how to change it.
|
Prerequisites
Before you begin, ensure the following requirements are in place:
| Requirement | Details |
|---|---|
Helm |
Helm 4.0 or later, which the chart requires, installed and configured against your cluster. |
Kloudfuse hostname |
The external hostname of your Kloudfuse cluster. |
API key |
If ingestion authentication is enabled, an API key — see Ingestion Authentication with API Key. |
OTel Collector Helm chart |
Chart version 0.162.0 or later. The install command below pins 0.178.3, the version the values file was tested with. That chart requires Kubernetes 1.24 or later. |
OTel Collector Contrib |
Version 0.153.0 or later. The values file uses the current component names (for example |
Nodes |
Nodes that run DaemonSet pods. EKS clusters that run only on Fargate are not supported, because Fargate does not run DaemonSets. |
EKS only |
|
Install the Collector
-
Download the values file:
curl -fsSLo helm-values.yaml https://raw.githubusercontent.com/kloudfuse-ext/customer/main/agents/kubernetes/otel/helm-values.yaml -
Edit the values marked CHANGE THESE at the top of the file, all under
extraEnvs:-
KLOUDFUSE_ENDPOINT—https://<kloudfuse-hostname>;. Usehttp://if TLS is not enabled on your Kloudfuse cluster. -
OTEL_RESOURCE_ATTRIBUTES— uncomment and setk8s.cluster.name=<cluster-name>if the cluster name is not detected automatically; see Cluster Name and Cloud Attributes.
-
-
Store the API key in a Secret. Skip this step if ingestion authentication is not enabled; the Collector starts without it. These commands can be run again, for example to change the key:
kubectl create namespace otel --dry-run=client -o yaml | kubectl apply -f - kubectl -n otel create secret generic kloudfuse-api-key \ --from-literal=api-key='<your-api-key>' \ --dry-run=client -o yaml | kubectl apply -f -The Collector reads the key when it starts. After you change the key in a running installation, restart the Collector pods:
kubectl -n otel rollout restart daemonset -l app.kubernetes.io/instance=kloudfuse-otel -
Add the OTel Helm repository and install:
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm repo update helm upgrade --install kloudfuse-otel open-telemetry/opentelemetry-collector \ --version 0.178.3 \ -f helm-values.yaml \ --namespace otel \ --create-namespace
A node taint with the effect NoSchedule or NoExecute keeps the Collector off that node unless the Collector tolerates it.
To collect from every node, including those, uncomment the tolerations block in the values file:
tolerations:
- operator: Exists
Install the chart once per cluster. A second Collector DaemonSet on the same cluster conflicts on the OTLP host ports (4317, 4318); merge its configuration into this file instead.
The memory_ballast extension was removed in OTel Collector Contrib 0.97.0 and later.
Remove it from any existing configurations — it will cause a startup failure with unknown type: "memory_ballast".
|
How the Configuration Works
Each Collector pod handles two kinds of data, in separate pipelines:
| Scope | Data | Where it runs |
|---|---|---|
Node |
Container logs, |
Every Collector pod, for its own node |
Cluster |
|
One Collector pod at a time, chosen by leader election |
Cluster-level receivers use the k8s_leader_elector extension, one lease per receiver.
Only the pod that holds a receiver’s lease runs that receiver, so cluster data is sent once rather than once per node.
If that pod stops, another pod takes over the lease.
The cluster-level pipelines remove the host attributes (host., azure.vm., and cloud.availability_zone) that resource detection adds.
Those attributes describe the node the Collector pod runs on, and the leader’s node is unrelated to a deployment, event, or object elsewhere in the cluster.
Node-level pipelines keep them.
The Service the chart creates uses internalTrafficPolicy: Local, so OTLP data from an application reaches the Collector on the application’s own node and gets that node’s attributes.
Point instrumented pods at kloudfuse-otel-opentelemetry-collector.otel:4317 (gRPC) or :4318 (HTTP).
Processors run in this order in every pipeline: memory_limiter first, then the attribute processors, then batch last.
Cluster Name and Cloud Attributes
The resource_detection processor reads the cluster name and cloud attributes from the cloud provider’s metadata service.
Detectors for clouds you do not run on add nothing, so the same file works everywhere:
processors:
resource_detection:
detectors: [env, eks, ec2, gcp, aks, azure]
override: false
timeout: 5s
eks:
resource_attributes:
k8s.cluster.name:
enabled: true # off by default on EKS
aks:
resource_attributes:
k8s.cluster.name:
enabled: true # off by default on AKS
How the cluster name is found on each platform:
| Platform | Cluster name |
|---|---|
GKE |
Detected automatically from the GCP metadata server. |
EKS on EC2 nodes |
Detected from the EC2 instance tags. Needs |
AKS |
Parsed from the node resource group name ( |
On-premises and other clusters |
Not detected. Set it with |
To set the cluster name yourself, uncomment OTEL_RESOURCE_ATTRIBUTES under extraEnvs.
The env detector is listed first, so this value wins over any detected one:
extraEnvs:
- name: OTEL_RESOURCE_ATTRIBUTES
value: "k8s.cluster.name=<cluster-name>"
Cloud Account and GCP Project
The cloud.account.id attribute holds the AWS account ID on AWS, the GCP project ID on GCP, and the Azure subscription ID on Azure.
It is set only where a cloud detector finds it, so on-premises clusters do not have it.
Only GCP has projects, so the values file sets a separate project attribute on GCP only:
processors:
transform/gcp_project:
error_mode: ignore
metric_statements:
- context: resource
statements:
- set(resource.attributes["project"], resource.attributes["cloud.account.id"]) where resource.attributes["cloud.provider"] == "gcp"
# log_statements and trace_statements repeat the same statement
Label Names in Kloudfuse
Kloudfuse renames some OpenTelemetry attributes when it ingests them, to match the labels used by other agents. Use the Kloudfuse names in queries and filters:
| OpenTelemetry attribute | Kloudfuse label |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logs
The logsCollection preset mounts /var/log/pods and adds a file_log receiver that tails every container’s log file on the node.
OTLP logs from instrumented pods share the same pipeline:
presets:
logsCollection:
enabled: true
includeCollectorLogs: false
config:
exporters:
otlp_http:
logs_endpoint: ${env:KLOUDFUSE_ENDPOINT}/ingester/otlp/v1/logs
headers:
Kf-Api-Key: ${env:KLOUDFUSE_API_KEY}
service:
pipelines:
logs:
receivers: [otlp, file_log]
processors: [memory_limiter, k8s_attributes, resource_detection, transform/gcp_project, batch]
exporters: [otlp_http]
Traces
Instrumented pods send traces to the Collector over OTLP:
config:
exporters:
otlp_http:
traces_endpoint: ${env:KLOUDFUSE_ENDPOINT}/ingester/otlp/traces
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, k8s_attributes, resource_detection, transform/gcp_project, batch]
exporters: [otlp_http]
Kubernetes and System-Level Metrics
Kloudfuse APM Services correlate APM data with Kubernetes infrastructure metrics on the Infra tab of a service detail page.
The values file collects metrics in two pipelines:
-
metrics—kubelet_stats,hostmetrics, and OTLP metrics, about the Collector’s own node. -
metrics/cluster—k8s_cluster, about the whole cluster. It runs on the leader only, and its data has the node’s host attributes removed.
config:
extensions:
k8s_leader_elector/k8s_cluster:
auth_type: serviceAccount
lease_name: kloudfuse-otel-k8s-cluster
lease_namespace: ${env:OTEL_K8S_NAMESPACE}
processors:
resource/kf_metrics_agent:
attributes:
- key: kf_metrics_agent (1)
value: otlp
action: upsert
resource/drop_node_identity: (2)
attributes:
- pattern: ^host\.
action: delete
- pattern: ^azure\.vm\.
action: delete
- key: cloud.availability_zone
action: delete
transform/k8s_pod_phase: (3)
metric_statements:
- context: datapoint
statements:
- set(datapoint.attributes["phase"], "Pending") where metric.name == "k8s.pod.phase" and datapoint.value_int == 1
- set(datapoint.attributes["phase"], "Running") where metric.name == "k8s.pod.phase" and datapoint.value_int == 2
- set(datapoint.attributes["phase"], "Succeeded") where metric.name == "k8s.pod.phase" and datapoint.value_int == 3
- set(datapoint.attributes["phase"], "Failed") where metric.name == "k8s.pod.phase" and datapoint.value_int == 4
- set(datapoint.attributes["phase"], "Unknown") where metric.name == "k8s.pod.phase" and datapoint.value_int == 5
receivers:
kubelet_stats:
collection_interval: 30s
auth_type: serviceAccount
endpoint: https://${env:K8S_NODE_IP}:10250
insecure_skip_verify: true (4)
node: ${env:K8S_NODE_NAME}
k8s_api_config: # reads node capacity for the *.node.utilization metrics
auth_type: serviceAccount
metric_groups: [node, pod, container, volume]
# see the values file for the full receiver settings
k8s_cluster:
k8s_leader_elector: k8s_leader_elector/k8s_cluster
auth_type: serviceAccount
collection_interval: 30s
allocatable_types_to_report: [cpu, memory, pods]
node_conditions_to_report: [Ready, MemoryPressure]
metrics:
k8s.node.condition:
enabled: true
service:
pipelines:
metrics:
receivers: [otlp, kubelet_stats, hostmetrics]
processors: [memory_limiter, k8s_attributes, resource_detection, transform/gcp_project, resource/kf_metrics_agent, batch]
exporters: [otlp_http]
metrics/cluster:
receivers: [k8s_cluster]
processors: [memory_limiter, resource_detection, resource/drop_node_identity, transform/gcp_project, resource/kf_metrics_agent, transform/k8s_pod_phase, batch]
exporters: [otlp_http]
| 1 | kf_metrics_agent: otlp enables correlation of host metrics with APM services in the Kloudfuse UI. |
| 2 | resource/drop_node_identity removes the leader node’s host attributes from cluster-level data. |
| 3 | transform/k8s_pod_phase converts the numeric pod phase value from k8s_cluster into a human-readable string label. |
| 4 | The kubelet’s certificate is not checked, because on many clusters it is not signed for the node’s IP address. Each Collector pod talks only to the kubelet on its own node. |
The ClusterRole grants nodes/stats, which is all kubelet_stats needs here. It does not grant nodes/proxy, which would open every kubelet endpoint to the Collector.
The receiver.kubeletstats.enableCPUUsageMetrics feature gate is stable in current Collector versions and no longer needs to be set.
|
Scrape Prometheus Metrics from Pods
The values file includes a prometheus receiver, commented out.
It scrapes pods that carry the annotation prometheus.io/scrape: "true", and honors prometheus.io/port and prometheus.io/path when present.
Each Collector pod scrapes only the pods on its own node, so no metric is collected twice.
To turn it on, uncomment the prometheus block in the values file, remove the line prometheus: null, and add prometheus to the receivers of the metrics pipeline.
| Scraping can add a large number of metrics. Check the volume on a test cluster before you turn it on everywhere. |
Kubernetes Events
Kloudfuse ingests Kubernetes events through a dedicated logs pipeline using the k8s_events receiver.
The receiver uses leader election, so one Collector pod sends each event even though the Collector runs on every node.
Earlier versions of this page required a separate Deployment for events; that is no longer needed.
config:
extensions:
k8s_leader_elector/k8s_events:
auth_type: serviceAccount
lease_name: kloudfuse-otel-k8s-events
lease_namespace: ${env:OTEL_K8S_NAMESPACE}
exporters:
otlp_http/k8s_events:
logs_endpoint: ${env:KLOUDFUSE_ENDPOINT}/ingester/otlp/k8s_events (1)
headers:
Kf-Api-Key: ${env:KLOUDFUSE_API_KEY}
receivers:
k8s_events:
k8s_leader_elector: k8s_leader_elector/k8s_events
auth_type: serviceAccount
processors:
resource/kf_events_agent:
attributes:
- key: kf_events_agent
value: otlp
action: upsert
service:
pipelines:
logs/k8s_events: (2)
receivers: [k8s_events]
processors: [memory_limiter, resource_detection, resource/drop_node_identity, transform/gcp_project, resource/kf_events_agent, batch]
exporters: [otlp_http/k8s_events]
| 1 | Kloudfuse treats data sent to /ingester/otlp/k8s_events as Kubernetes events, not log records. |
| 2 | This must be a separate pipeline from the main logs pipeline — do not add k8s_events to an existing pipeline. |
Verify Events Are Arriving
Kubernetes events collected by the k8s_events receiver and sent to /ingester/otlp/k8s_events appear in the Events view, with the source kubernetes and the label kf_events_agent=otlp.
In the Events view, filter by:
kf_events_agent = otlp
To see one cluster or namespace, add kube_cluster_name = <cluster-name> or kube_namespace = <namespace>.
Events from the Datadog Agent appear in the same view under source="kubernetes". The kf_events_agent label tells the OTel Collector’s events apart.
|
Kubernetes Infrastructure Objects
Kloudfuse ingests Kubernetes infrastructure objects (pods, nodes, deployments, etc.) using the k8s_objects receiver.
Objects appear in the Kloudfuse UI under Infrastructure > Kubernetes.
| Objects need their own pipeline and exporter. Do not reuse an existing logs pipeline for objects. |
Kloudfuse drops objects that have not been updated within 15 minutes. The values file pulls every object kind every 5 minutes with the receiver-level interval; a kind without an interval would otherwise be pulled only once an hour.
|
The receiver exports each ConfigMap in full, including its data, from every namespace it watches. The values file collects ConfigMaps, so they appear in the Infrastructure view. If some of yours hold sensitive values, restrict the configmaps entry with namespaces: or label_selector:, or remove it from both the object list and the first clusterRole rule.
|
The gatewayclasses, gateways, and httproutes entries require the Gateway API CRDs. The receiver sets error_mode: ignore so the pipeline still collects every other kind on a cluster without those CRDs; without it, the receiver’s default (propagate) puts the whole pipeline into an error state instead.
|
config:
extensions:
k8s_leader_elector/k8s_objects:
auth_type: serviceAccount
lease_name: kloudfuse-otel-k8s-objects
lease_namespace: ${env:OTEL_K8S_NAMESPACE}
exporters:
otlp_http/k8s_objects:
logs_endpoint: ${env:KLOUDFUSE_ENDPOINT}/ingester/otlp/k8s_objects
headers:
Kf-Api-Key: ${env:KLOUDFUSE_API_KEY}
receivers:
k8s_objects:
k8s_leader_elector: k8s_leader_elector/k8s_objects
auth_type: serviceAccount
error_mode: ignore
interval: 5m
objects:
- name: pods
- name: nodes
- name: namespaces
- name: deployments
# see the values file for the full list of kinds
processors:
resource/kf_infra_agent:
attributes:
- key: kf_infra_agent (1)
value: otlp
action: upsert
service:
pipelines:
logs/k8s_objects:
receivers: [k8s_objects]
processors: [memory_limiter, resource_detection, resource/drop_node_identity, transform/gcp_project, resource/kf_infra_agent, batch]
exporters: [otlp_http/k8s_objects]
| 1 | kf_infra_agent: otlp enables filtering by OTel-sourced objects in the Kloudfuse UI. |
The values file’s clusterRole.rules grant read access to every listed kind.
Leader election keeps its leases in the Collector’s own namespace, so the permission to manage leases is granted only there, by a Role and RoleBinding that the values file creates through extraManifests:
extraManifests:
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: '{{ include "opentelemetry-collector.fullname" . }}-leases'
namespace: '{{ .Release.Namespace }}'
rules:
- apiGroups: [coordination.k8s.io]
resources: [leases]
verbs: [get, list, watch, create, update, patch, delete]
# a RoleBinding with the same name binds this Role to the Collector's service account
| Missing RBAC rules can silently prevent object collection without visible errors in the Collector logs. |
Verify Signals Are Arriving
-
Confirm the Collector DaemonSet pods are running:
kubectl get pods -n otel -l app.kubernetes.io/instance=kloudfuse-otelYou should see one pod per node, except nodes with a taint the Collector does not tolerate. If pods are missing, run
kubectl -n otel describe daemonsetand check the nodes forNoScheduleorNoExecutetaints; uncomment thetolerationsblock in the values file to run on those nodes. -
Check the Collector logs for export errors:
kubectl logs -n otel -l app.kubernetes.io/instance=kloudfuse-otel | grep -i "error\|warn\|failed" -
In the Kloudfuse UI, click Infrastructure > Kubernetes. Your cluster nodes and pods should appear within a few minutes of the Collector starting. Use the filter
kf_infra_agent=otlpto confirm the OTel Collector is the data source. -
To verify metrics, open Metrics Explorer and search for
k8s_node_cpu_usage. Filter bykube_cluster_nameto scope to your cluster. -
To verify traces, click APM > Services. Instrumented services should appear once they receive traffic.
Troubleshooting
Collector Pods Not Starting
If no Collector pods exist at all, check the nodes for NoSchedule or NoExecute taints.
The Collector does not run on such a node unless it tolerates the taint; uncomment the tolerations block in the values file.
If pods are in CrashLoopBackOff or Pending:
-
Check pod events for configuration errors:
kubectl describe pod -n otel <collector-pod> -
Validate the Collector configuration by checking the logs immediately after startup — configuration parse errors are printed on startup. An
unknown typeerror forresource_detection,k8s_attributes, orotlp_httpmeans the Collector image is older than 0.153.0. -
Confirm
KLOUDFUSE_ENDPOINTin the values file points to your Kloudfuse cluster.
No Data Appearing in Kloudfuse
If pods are running but no data appears:
-
Confirm the Kloudfuse endpoint is reachable from the cluster:
kubectl exec -it <collector-pod> -n otel -- wget -qO- https://<kloudfuse-hostname>/ingester/otlp/v1/logsA 4xx response indicates the endpoint is reachable. A connection timeout indicates a network or firewall issue.
-
Check whether a
NetworkPolicyblocks egress from the Collector pods to the Kloudfuse hostname on port 443. -
If authentication is enabled, confirm the
kloudfuse-api-keySecret exists in theotelnamespace and holds an active key from Administration → API Keys. If you changed the key, restart the Collector pods so they read it, as described in Install the Collector.
Cluster Name Missing
If data arrives without a kube_cluster_name label, the cluster name was not detected.
On EKS, check the IAM permission and the instance metadata hop limit listed in Prerequisites.
On any platform, set the name with OTEL_RESOURCE_ATTRIBUTES as described in Cluster Name and Cloud Attributes.
Kubernetes Events Not Appearing
If metrics and traces appear but events are missing:
-
Confirm the
k8s_eventsreceiver is included in thelogs/k8s_eventspipeline in your Helm values. -
Confirm the Collector service account has permission to list and watch
events:kubectl auth can-i list events --as=system:serviceaccount:otel:kloudfuse-otel-opentelemetry-collectorIf this returns
no, update the ClusterRole to includeeventsin its resource list.