RousselTMLEARNING

Article · Datadog: from discovery to expertise

Datadog on Kubernetes

1. Architecture #

The components.

Components #

Datadog on Kubernetes
ComponentRole
Agent (DaemonSet)One per node: node and container metrics, container logs, trace reception
Cluster AgentQueries the Kubernetes API once for the whole cluster (instead of each agent), distributes cluster checks, provides external metrics for the HPA, hosts the admission controller
Datadog OperatorManages the agent and Cluster Agent from a DatadogAgent resource

2. Installing with the Operator #

Declarative.

Installation #

helm repo add datadog https://helm.datadoghq.com && helm repo update
helm install datadog-operator datadog/datadog-operator
kubectl create secret generic datadog-secret --from-literal api-key="$DD_API_KEY"
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
  name: datadog
spec:
  global:
    clusterName: prod-eu
    site: datadoghq.eu
    credentials:
      apiSecret: { secretName: datadog-secret, keyName: api-key }
  features:
    logCollection: { enabled: true, containerCollectAll: true }
    apm:
      instrumentation: { enabled: true }      # injection automatique des bibliothèques APM
    liveProcessCollection: { enabled: true }
    orchestratorExplorer: { enabled: true }
Good to know: The datadog/datadog Helm chart remains an alternative; the Operator has the advantage of a single resource, validated and easy to version with GitOps.

3. Autodiscovery #

Monitoring whatever arrives.

Annotations #

Autodiscovery applies a check configuration to each matching container as soon as it starts. The configuration is set as annotations on the pod:

metadata:
  annotations:
    ad.datadoghq.com/redis.checks: |
      { "redisdb": { "instances": [ { "host": "%%host%%", "port": "6379" } ] } }
    ad.datadoghq.com/redis.logs: '[{"source": "redis", "service": "cache"}]'
  labels:
    tags.datadoghq.com/env: prod
    tags.datadoghq.com/service: cache
    tags.datadoghq.com/version: "7.2"
Good practice: The tags.datadoghq.com/* labels apply unified tagging to the pod's metrics, logs and traces: it is the first thing to standardize in your charts.

4. Troubleshooting #

Useful commands.

Commands #

kubectl exec -it ds/datadog-agent -- agent status          # état des checks, logs, APM
kubectl exec -it ds/datadog-agent -- agent configcheck     # configurations Autodiscovery résolues
kubectl exec -it deploy/datadog-cluster-agent -- datadog-cluster-agent status
SymptomCommon cause
No container logscontainerCollectAll disabled, or /var/log/pods path not mounted
Check not runningContainer name different from the one in the ad.datadoghq.com/<container> annotation
Duplicate metricsCluster check run by every agent instead of the Cluster Agent

📄 Datadog on Kubernetes: Operator, Cluster Agent and Autodiscovery →

My progress

  • ⏱ Estimated time : ≈ 7 min

Sign in to track your progress and take notes. Sign in

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Recommended Articles

Installing the Datadog agent and configuring integrations

Install the Datadog agent on Linux, Docker and Kubernetes (Datadog Operator), understand datadog....

Datadog: the SaaS observability platform at a glance

What Datadog is, its products (infrastructure, logs, APM, RUM, synthetics, security), its concept...

Advanced Datadog APM: sampling, retention, profiler and Software Catalog

Go further with Datadog APM: ingestion control and sampling, retention filters, trace metrics, Co...

RUM and Synthetic Monitoring with Datadog: synthetic transaction monitoring and user experience

Measure user experience with Datadog: browser and mobile RUM, Core Web Vitals, Session Replay, li...

Datadog APM and OpenTelemetry: traces, services and correlation with logs

Instrument applications for Datadog APM (dd-trace, single step instrumentation, OpenTelemetry), u...

Monitors, SLOs, dashboards and Datadog as code

Create effective monitors (metrics, logs, APM, composites, anomalies), SLOs, dashboards, and mana...

Advanced infrastructure with Datadog: network, cloud, containers and databases

Monitor infrastructure beyond hosts: Network Performance Monitoring, AWS, Azure and GCP integrati...

OpenTelemetry on Kubernetes: Operator, auto-instrumentation and Collector

Deploy OpenTelemetry on Kubernetes: Collector deployment modes (DaemonSet, Deployment, sidecar, S...

Datadog platform architecture: sites, organizations, keys and data model

Understand Datadog's architecture: data sources (agent, cloud integrations, SDKs, OpenTelemetry),...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!