Skip to main content
Welcome to the Datadog data ingestion lesson from the Datadog migration course at KodeKloud. This guide explains how Datadog collects and sends telemetry from your environment and applications to the Datadog platform. You’ll see how Datadog components are deployed to a local k3d Kubernetes cluster, how authentication is configured, how to instrument a Node.js app with tracing and logs, and how to generate traffic to observe telemetry in Datadog (metrics, logs, traces, and profiling). Key topics covered:
  • Datadog Kubernetes UI overview
  • Local k3d environment (k3s running in Docker)
  • Datadog components in Kubernetes (Agent, Cluster Agent, Operator)
  • Installing Datadog via Helm and creating the API key secret
  • DatadogAgent CR example (operator-based install)
  • Instrumenting a Node.js app with dd-trace
  • Building the Docker image and deploying the app pod
  • Generating traffic with k6 and viewing logs/traces in Datadog

Datadog Infrastructure → Kubernetes Overview

From the Datadog console (this demo uses the US5 site), the Infrastructure → Kubernetes Overview gives a concise, high-level view of connected clusters. Clicking a cluster updates dashboards to show counts for clusters, namespaces, nodes, deployments, pods, containers, ReplicaSets, and Services.
The image shows a Datadog dashboard with a menu open for infrastructure options and a main screen displaying no matches found for services and issues. Dashboard links and other features are visible on the right.
The Kubernetes overview shows useful cluster metrics and summary tiles.
The image shows a dashboard for monitoring Kubernetes resources, displaying various metrics like clusters, nodes, pods, and containers. Each section provides insights into the current state and usage of these resources.
Scrolling in the Kubernetes overview surfaces FinOps insights and application troubleshooting patterns (e.g., deployments with unavailable replicas, pods in symptomatic phases, container restarts, node and volume details).
The image shows a dashboard for troubleshooting patterns in a Kubernetes environment, focusing on deployments with unavailable replicas. It includes a list of deployments, clusters, namespaces, and their current status.
Resource utilization dashboards help with capacity planning — CPU/memory usage, over-provisioned workloads, unbound volumes, and recommended dashboards.
The image shows a dashboard interface displaying resource utilization metrics for various pod groups, including CPU and memory usage. It includes sections for unbound volumes, over-provisioned workloads, and recommended dashboards.

Local lab environment — k3d (k3s in Docker)

This demo uses k3d, a lightweight tool that runs k3s inside Docker. Each k3d node is a Docker container, so docker ps (or k3d docker ps) shows Kubernetes nodes as containers. Example k3d help summary:
Example docker ps output for a k3d cluster:
From inside the cluster, use kubectl to list nodes and pods:

Datadog components in Kubernetes

Common Datadog components deployed in Kubernetes (installed via Helm or Operator): Verify daemonsets and deployments:

Installing Datadog via Helm

Add the Datadog Helm repo and install the chart:
You can install the chart either before or after creating the Kubernetes secret that contains the Datadog API key, but the Agent requires credentials to authenticate and send telemetry.

API keys and Kubernetes secrets

Create an API key in the Datadog web UI (Organization Settings → API keys). Store the key in a Kubernetes secret for the Agent to use:
Replace <DATADOG_API_KEY> with the key you copied from Datadog. Verify the secret exists:
Datadog UI views for API keys and cluster dashboards:
The image shows a Datadog dashboard displaying the state of Kubernetes resources, including clusters, namespaces, nodes, and other metrics, alongside information on autoscaling operations and resource costs.
The image shows a screen from an application under "Organization Settings," specifically displaying a list of API keys along with their details such as name, key ID, creation date, and last used date.

DatadogAgent (Operator) example

When using the Datadog Operator, the DatadogAgent CR references the secret with the API key. Example DatadogAgent manifest:
Important fields:
  • clusterName — how the cluster will appear in Datadog.
  • site — Datadog site/region (e.g., us5.datadoghq.com).
  • credentials.secret — Kubernetes secret name/key that contains the API key.
  • features — enable orchestratorExplorer, logCollection, apm, and profiling.
Apply the DatadogAgent manifest:
If the Agents start without a valid secret or with an incorrect secret reference, they will fail to authenticate. Use kubectl logs on the Agent pods to diagnose authentication errors.
Ensure the secret name and key in the DatadogAgent manifest match the actual Kubernetes secret. Missing or incorrect API key references will prevent the Agent from sending telemetry.

Application instrumentation (Node.js)

This demo uses a simple Node.js REST API with three routes. To enable Datadog tracing for Node.js, install dd-trace and initialize it as early as possible — before other imports or application initialization.
Always require and initialize dd-trace at the top of your application entrypoint (before requiring frameworks like express) so auto-instrumentation captures requests and internal spans.
Example index.js (tracing + basic routes):

Dockerfile

Make sure dd-trace is installed in the image so the tracer import resolves at runtime.

Pod manifest (example)

The application pod example includes environment variables used by the Datadog tracer/agent and references the datadog-secret for the API key.
Apply the pod manifest and check pods:

Traffic generation with k6

Use a lightweight k6 script to exercise the Node.js routes and quickly create traces and logs. load.js:
Run k6 (after port-forwarding or deploying the service so the endpoints are reachable):

Logs and traces in Datadog

The Datadog Agent forwards logs and receives traces (APM) on port 8126. After generating traffic, you can inspect application logs and traces in Datadog. Logs Explorer (filter by service, host, or container) shows timestamp, host, service, content, and extracted severity levels (info/warn/error).
The image shows a Datadog interface displaying log data, with filters and sources listed on the left and detailed logs including dates, hosts, services, and content in the main view.
Use the left sidebar filters to narrow logs to your node-app service or to a specific host/container.
The image shows a Datadog Log Explorer interface displaying log data with details such as date, host, service, and content, alongside filtering options on the left sidebar.
Click into an application log to see extracted fields and severity. The example below shows an error emitted by route1 in the Node.js app.
The image shows a screenshot of the Datadog Log Explorer interface, displaying logs for the "node-app" service with a visible error message dated July 5, 2025. It includes filters and details about hosts, sources, and containers.
APM → Trace Explorer displays traces composed of spans (Express handlers, DB calls, HTTP calls, etc.). Click a trace to view span breakdowns, attributes (environment, user agent, route, status code), and timings. This example shows a GET /route2 trace.
The image shows a Datadog APM interface displaying traces and span details for an HTTP GET request to a "node-app" service on route "/route2." The HTTP request was successful with a status code of 200.
Traces are critical for distributed systems — they reveal service call flows, span durations, and where latencies or errors occur.

Wrap up — What you accomplished

This lesson demonstrated how to:
  • Deploy and validate Datadog components (Agent, Cluster Agent, Operator) in Kubernetes and verify daemonsets/pods.
  • Create a Kubernetes secret for the Datadog API key and reference it in the DatadogAgent configuration.
  • Instrument a Node.js application with dd-trace (initialize at the top of the entrypoint) and include the tracer in the Docker image.
  • Configure the application pod with environment variables so the Agent can collect traces, logs, and profiles.
  • Generate traffic with k6 and observe logs/traces inside Datadog.
Final dashboard view:
The image shows a Datadog dashboard displaying the state of Kubernetes resources, including clusters, namespaces, nodes, and other metrics, alongside information on autoscaling operations and resource costs.
Follow these steps — install the Helm chart or operator, create the API key secret, apply the DatadogAgent CR (if using the operator), instrument your app, and generate traffic — to capture rich telemetry in Datadog: metrics, logs, traces, and profiles for monitoring and troubleshooting. Links and references

Watch Video