This document is a guide to running the profiler in a Kubernetes cluster.
The datadog-agent must be running in the cluster and configured to collect APM data (this is enabled by default in the agent, unless you explicitly disabled it). See https://docs.datadoghq.com/containers/kubernetes/apm/ for more information.
For the purposes of this guide, we assume that the datadog agent is accessible at a specific address: http://<agent_address>:8126.
See https://github.com/DataDog/dd-otel-host-profiler/pkgs/container/dd-otel-host-profiler/ for a container image that can be used to run the profiler.
To run the profiler in a Kubernetes cluster, you should ensure the following requirements are met (see example below):
- The container has host PID enabled.
- The container is running in privileged mode.
- The container has the
SYS_ADMINcapability. - The
DD_TRACE_AGENT_URLenvironment variable is set to the address of the Datadog agent:http://<agent_address>:8126. - To enable the profiler to upload debug symbols when they're available locally (required to have function names for compiled languages like C/C++/Rust/Go/...), you must configure:
- The
DD_SITEenvironment variable to your Datadog site (e.g.datadoghq.com,datadoghq.eu,us5.datadoghq.com, ...). - The
DD_API_KEYenvironment variable to your Datadog API key.
- The
The profiler pod spec excerpt:
apiVersion: apps/v1
# ...
spec:
# ...
template:
# ...
spec:
# ...
hostPID: true # Setting hostPID to true (1.)
containers:
- name: dd-otel-host-profiler
securityContext:
runAsUser: 0
privileged: true # Running in privileged mode (2.)
capabilities:
add:
- SYS_ADMIN # Adding SYS_ADMIN capability (3.)
env:
- name: DD_TRACE_AGENT_URL # The address of the Datadog agent (4.)
value: "http://<agent_address>:8126"
- name: DD_SERVICE
value: "dd-otel-host-profiler"
- name: DD_SITE
value: "YOUR_DATADOG_SITE" # The Datadog site (5.)
- name: DD_API_KEY # The Datadog API Key (5.)
valueFrom:
# The example below uses a Kubernetes secret to store the API key.
secretKeyRef:
name: some-user
key: dd-api-key
# ...