- If you haven’t already, install the Helm chart.
The default configuration creates a directory on the host and mounts it within the Agent. The Agent then creates and listens on a socket file /var/run/datadog/apm.socket
. The application pods can then similarly mount this volume and write to this same socket. You can modify the path and socket with the datadog.apm.hostSocketPath
and datadog.apm.socketPath
configuration values.
This feature can be disabled with datadog.apm.socketEnabled
.
The Datadog Agent can also be configured to receive traces over TCP. To enable this feature:
- Update your
values.yaml
file with the following APM configuration:datadog:
## Enable apm agent and provide custom configs
apm:
# datadog.apm.portEnabled -- Enable APM over TCP communication (port 8126 by default)
## ref: https://docs.datadoghq.com/agent/kubernetes/apm/
portEnabled: true
Then, upgrade your Datadog Helm chart using the following command: helm upgrade -f values.yaml <RELEASE NAME> datadog/datadog
. If you did not set your operating system in values.yaml
, add --set targetSystem=linux
or --set targetSystem=windows
to this command.
Warning: The datadog.apm.portEnabled
parameter opens a port on your host. Make sure your firewall only allows access from your applications or trusted sources. If your network plugin doesn’t support hostPorts
, add hostNetwork: true
in your Agent pod specifications. This shares the network namespace of your host with the Datadog Agent. This also means that all ports opened on the container are opened on the host. If a port is used both on the host and in your container, they conflict (since they share the same network namespace) and the pod does not start. Some Kubernetes installations do not allow this.
To enable APM trace collection, open the DaemonSet configuration file and edit the following:
Allow incoming data from port 8126
(forwarding traffic from the host to the agent) within the trace-agent
container:
# (...)
containers:
- name: trace-agent
# (...)
ports:
- containerPort: 8126
hostPort: 8126
name: traceport
protocol: TCP
# (...)
If using an old agent version (7.17 or lower), in addition to the steps above, set the DD_APM_NON_LOCAL_TRAFFIC
and DD_APM_ENABLED
variable to true
in your env
section of the datadog.yaml
trace Agent manifest:
# (...)
containers:
- name: trace-agent
# (...)
env:
- name: DD_APM_ENABLED
value: 'true'
- name: DD_APM_NON_LOCAL_TRAFFIC
value: "true"
# (...)
Warning: The hostPort
parameter opens a port on your host. Make sure your firewall only allows access from your applications or trusted sources. If your network plugin doesn’t support hostPorts
, add hostNetwork: true
in your Agent pod specifications. This shares the network namespace of your host with the Datadog Agent. This also means that all ports opened on the container are opened on the host. If a port is used both on the host and in your container, they conflict (since they share the same network namespace) and the pod does not start. Some Kubernetes installations do not allow this.
To enable APM trace collection, open the DaemonSet configuration file and edit the following:
# (...)
containers:
- name: trace-agent
# (...)
env:
- name: DD_APM_ENABLED
value: "true"
- name: DD_APM_RECEIVER_SOCKET
value: "/var/run/datadog/apm.socket"
# (...)
volumeMounts:
- name: apmsocket
mountPath: /var/run/datadog/
volumes:
- hostPath:
path: /var/run/datadog/
type: DirectoryOrCreate
# (...)
This configuration creates a directory on the host and mounts it within the Agent. The Agent then creates and listens on a socket file in that directory with the DD_APM_RECEIVER_SOCKET
value of /var/run/datadog/apm.socket
. The application pods can then similarly mount this volume and write to this same socket.
When APM is enabled, the default configuration creates a directory on the host and mounts it within the Agent. The Agent then creates and listens on a socket file /var/run/datadog/apm/apm.socket
. The application pods can then similarly mount this volume and write to this same socket. You can modify the path and socket with the features.apm.unixDomainSocketConfig.path
configuration value.
The Datadog Agent can also be configured to receive traces over TCP. To enable this feature:
Update your DatadogAgent
manifest with the following:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
credentials:
apiKey: <DATADOG_API_KEY>
site: <DATADOG_SITE>
features:
apm:
enabled: true
hostPortConfig:
enabled: true
Where your <DATADOG_SITE>
is
(defaults to datadoghq.com
).
See the sample manifest with APM and metrics collection enabled for a complete example.
Then apply the new configuration:
kubectl apply -n $DD_NAMESPACE -f datadog-agent.yaml
Warning: The hostPort
parameter opens a port on your host. Make sure your firewall only allows access from your applications or trusted sources. If your network plugin doesn’t support hostPorts
, add hostNetwork: true
in your Agent pod specifications. This shares the network namespace of your host with the Datadog Agent. This also means that all ports opened on the container are opened on the host. If a port is used both on the host and in your container, they conflict (since they share the same network namespace) and the pod does not start. Some Kubernetes installations do not allow this.