Datadog Kubernetes Integration
Overview
The Datadog Agent can run as a DaemonSet (one pod per node) with Cluster Agents(one or two replicas). Together they collect:
-
Node-level metrics — CPU, memory, disk, and network from each node via the node agent
-
Kube-state metrics — Kubernetes object state (deployments, pods, nodes) via the Cluster Agent
-
Container logs — collected from all running containers and forwarded over HTTPS
-
Kubernetes events — pod scheduling, node conditions, and deployment changes via the Cluster Agent
-
Application traces — received from instrumented pods over port 8126 and forwarded to the Kloudfuse APM ingester
Prerequisites
Before you begin, ensure the following requirements are in place:
| Requirement | Details |
|---|---|
Datadog Agent version |
Version 7.41 or higher required when repointing an existing agent from Datadog HQ to Kloudfuse. |
Helm chart version |
Datadog Helm chart version 3.1.10 or higher required. |
Install the Datadog Agent
Add the Datadog Helm repository:
helm repo add datadog https://helm.datadoghq.com
helm repo update
Create a datadog-values.yaml with your Kloudfuse hostname.
This configuration enables logs, traces, metrics, and orchestrator exploration:
datadog:
apiKey: <ingester-api_key>
dd_url: https://<kloudfuse-hostname> (1)
logsEnabled: true
logs:
enabled: true
containerCollectAll: true
containerCollectUsingFiles: true
autoMultiLineDetection: true
kubeStateMetricsEnabled: false
kubeStateMetricsCore:
enabled: true
ignoreLegacyKSMCheck: true
orchestratorExplorer:
enabled: true
apm:
enabled: true
portEnabled: true
dogstatsd:
port: 8125
useHostPort: true
processAgent:
enabled: true
prometheusScrape:
enabled: true
version: 1
clusterAgent:
replicaCount: 1
enabled: true
datadog_cluster_yaml:
use_v2_api:
events: true
series: true
service_checks: true
orchestrator_explorer:
orchestrator_dd_url: "https://<kloudfuse-hostname>" (1)
admissionController:
enabled: false
agents:
useConfigMap: true
customAgentConfig:
use_v2_api:
events: true
series: true
service_checks: true
logs_config:
logs_dd_url: https://<kloudfuse-hostname>
logs_no_ssl: false
use_http: true
auto_multi_line_detection: true
use_v2_api: false
apm_config:
enabled: true
apm_non_local_traffic: true
apm_dd_url: "https://<kloudfuse-hostname>/ingester"
orchestrator_explorer:
orchestrator_dd_url: "https://<kloudfuse-hostname>" (1)
metadata_providers:
- name: host
interval: 300
| 1 | Replace <kloudfuse-hostname> with your Kloudfuse cluster hostname. |
Deploy the agent:
kubectl create namespace datadog-agent
helm upgrade --install datadog-agent -f datadog-values.yaml datadog/datadog \
-n datadog-agent \
--version 3.65.0
Dual Shipping
The Datadog Agent supports dual shipping — sending telemetry to multiple endpoints. This can be either Kloudfuse and another observability system or multiple instances of Kloudfuse.
Add the following to your existing Helm values file instead of replacing dd_url.
| Agent version 7.41 or higher and Helm chart version 3.1.10 or higher are required. |
Under the agents.customAgentConfig key:
agents:
customAgentConfig:
dd_url: "https://<kloudfuse-hostname>"
additional_endpoints:
"https://<alternate-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
use_v2_api:
series: true
logs_config:
logs_dd_url: https://<kloudfuse-hostname>
logs_no_ssl: false
use_http: true
use_v2_api: false
additional_endpoints:
- api_key: <api_key>
Host: <kloudfuse-hostname> # additional (Kloudfuse) endpoint
Port: 443
use_compression: true
apm_config:
apm_dd_url: "https://<kloudfuse-hostname>/ingester"
additional_endpoints:
"https://<kloudfuse-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
process_config:
process_dd_url: "https://<kloudfuse-hostname>/ingester" # original (primary) endpoint
additional_endpoints:
"https://<kloudfuse-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
metadata_providers:
- name: host
interval: 300
The <kloudfuse-hostname> entries are the original destination the Agent already ships to — another observability system, or your first Kloudfuse instance; keep them set to the endpoints from your existing single-destination configuration.
The additional_endpoints entries add the Kloudfuse destination: replace <kloudfuse-hostname> with your Kloudfuse cluster hostname and <api_key> with an ingestion API key.
Under the clusterAgent.datadog_cluster_yaml key:
clusterAgent:
datadog_cluster_yaml:
dd_url: "https://<kloudfuse-hostname>" # original (primary) endpoint
additional_endpoints:
"https://<kloudfuse-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
use_v2_api:
series: true
process_config:
process_dd_url: "https://<kloudfuse-hostname>/ingester" # original (primary) endpoint
additional_endpoints:
"https://<kloudfuse-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
orchestrator_explorer:
orchestrator_dd_url: "https://<kloudfuse-hostname>" # original (primary) endpoint
additional_endpoints:
"https://<kloudfuse-hostname>": # additional (Kloudfuse) endpoint
- <api_key>
Apply the changes:
helm upgrade datadog-agent -f datadog-values.yaml datadog/datadog -n <namespace>
Configure Logs
Log collection from all containers is enabled by the base values file above. To exclude specific containers from log collection:
datadog:
env:
- name: DD_CONTAINER_EXCLUDE_LOGS
value: "name:<container-name>"
To apply custom parsing or masking rules before forwarding:
agents:
customAgentConfig:
logs_config:
processing_rules:
- type: mask_sequences
name: mask_credit_cards
replace_placeholder: "[MASKED]"
pattern: \b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b
To override log settings for a specific pod, use Autodiscovery annotations:
annotations:
ad.datadoghq.com/<CONTAINER_NAME>.logs: >
[{"source": "my-app", "service": "my-service"}]
Configure Events
The Cluster Agent collects Kubernetes events (pod scheduling, node conditions, deployment rollouts) via the Kubernetes API. To forward process-level and container lifecycle events, add the following:
clusterAgent:
datadog_cluster_yaml:
process_config:
events_dd_url: "https://<kloudfuse-hostname>/ingester"
agents:
customAgentConfig:
process_config:
events_dd_url: "https://<kloudfuse-hostname>/ingester"
container_collection:
enabled: false
Verify Events Are Arriving
Kubernetes events collected by the Datadog Cluster Agent are stored in the Events store.
Query them in the Kloudfuse UI or via the /events-query GraphQL API:
{
events(
durationSecs: 300,
filter: { and: [{eq: {name: "@source", value: "kubernetes"}}] },
timestamp: "<ISO-8601-timestamp>",
limit: 20
) {
id title text severity source eventType host
labels { name value }
timestamp
}
}
Events from a specific pod appear with labels kube_namespace and kube_name.
The eventType field is kubernetes_apiserver for events collected by the Cluster Agent.
Datadog Agent Kubernetes events appear in the Events store (source="kubernetes").
This differs from the OTel Collector path, where Kubernetes events are stored in Logs (tagged kf_events_agent=otlp).
|
Configure Metrics
Kube-State-Metrics
Kube-state-metrics is enabled by the base values file above.
Set kubeStateMetricsEnabled: false to avoid running the legacy KSM check alongside the core check.
DogStatsD Custom Metrics
Configure application pods to send custom metrics to the agent on the node’s host IP:
env:
- name: DD_AGENT_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: DD_ENTITY_ID
valueFrom:
fieldRef:
fieldPath: metadata.uid
Prometheus Scraping
Prometheus autodiscovery is enabled by the base values file above. Add the following annotations to any pod that exposes a Prometheus endpoint:
prometheus.io/path: /metrics
prometheus.io/port: "9090"
prometheus.io/scrape: "true"
For explicit per-container configuration using Autodiscovery annotations:
ad.datadoghq.com/<CONTAINER_NAME>.check_names: '["openmetrics"]'
ad.datadoghq.com/<CONTAINER_NAME>.init_configs: '[{}]'
ad.datadoghq.com/<CONTAINER_NAME>.instances: >
[{"openmetrics_endpoint": "http://%%host%%:%%port%%/metrics"}]
High-Cardinality Tags
The Datadog Agent defaults to low cardinality, tagging metrics only at the host level.
Setting cardinality to orchestrator enables granular pod- and container-level tags:
datadog:
env:
- name: DD_CHECKS_TAG_CARDINALITY
value: "orchestrator"
See Datadog — Tag Cardinality for details.
Custom Tags
Add custom tags to all metrics collected by the agent.
Each tag must be in key:value format:
datadog:
tags:
- custom_tag_name:custom_tag_value
Verify Metrics Are Arriving
-
Confirm both the node agent and Cluster Agent pods are running:
kubectl get pods -n datadog-agentYou should see one
datadog-agent-pod per node and onedatadog-agent-cluster-agent-pod. -
Check the agent status for active checks and any errors:
kubectl exec -it <datadog-agent-pod> -n datadog-agent -- agent status -
In the Kloudfuse UI, click Infrastructure in the top navigation, then select Kubernetes. Your cluster nodes should appear within a few minutes of the agent starting.
-
To confirm host metrics are flowing, open Metrics Explorer, search for
kubernetes.cpu.usage.total, and filter bykube_cluster_name.
Troubleshooting
Agent Pods Not Ready
If agent pods are in CrashLoopBackOff or Pending:
-
Check pod events for resource constraints or image pull errors:
kubectl describe pod -n datadog-agent <agent-pod> -
Confirm the
datadog-values.yamlhas a validdd_urlpointing to your Kloudfuse cluster. -
Confirm the Helm chart version is 3.1.10 or higher:
helm list -n datadog-agent
Metrics Not Appearing in Kloudfuse
If pods are running but no metrics appear:
-
Inspect the agent logs for outbound connection errors:
kubectl logs -n datadog-agent <agent-pod> | grep -i "error\|warn\|failed" -
Confirm
dd_urlis set correctly in the agent configuration:kubectl exec -it <agent-pod> -n datadog-agent -- agent config | grep dd_url -
Verify the agent’s API key matches a valid ingestion key in Kloudfuse under Administration → API Keys.
Logs Not Appearing
If metrics appear but container logs do not:
-
Confirm
datadog.logsEnabled: trueandlogs.enabled: trueare set in your Helm values. -
Check the log agent section of the agent status output for collection errors:
kubectl exec -it <agent-pod> -n datadog-agent -- agent status | grep -A 20 "Logs Agent" -
Confirm
logs_dd_urlinagents.customAgentConfig.logs_configmatches your Kloudfuse hostname on port 443.