This feature was introduced in Datadog Operator v1.5.0 and was made generally available in v1.24.0.
DatadogAgentProfiles (DAPs), also known as profiles, can be created to override certain Operator settings that were set in a DatadogAgent (DDA) on a subset of nodes. The Supported Settings table lists which settings can be overridden and the minimum Operator versions for each. While multiple DAPs can be applied to a cluster, each DAP must target a different subset of nodes so the DAPs do not conflict with each other.
Example:
apiVersion: datadoghq.com/v1alpha1
kind: DatadogAgentProfile
metadata:
name: datadogagentprofile-sample
spec:
profileAffinity:
profileNodeAffinity:
- key: kubernetes.io/os
operator: In
values:
- linux
config:
override:
nodeAgent:
containers:
agent:
resources:
requests:
cpu: 256mThe DAP spec has two main sections:
profileAffinityis used to target a subset of nodes. It accepts a list of NodeSelectorRequirements.configdefines the configuration to override in the DDA. It follows the configuration formatting of the Operator's DatadogAgentSpec.
When a DAP is applied, the Operator creates a new DaemonSet for that profile using the same name as the DAP. Even if the Operator is configured to use ExtendedDaemonSets, it will still create DaemonSets for any DAPs. It will also create a DaemonSet (or an ExtendedDaemonSet, if enabled) for a default profile. The default profile uses the same name as the DDA and applies to all nodes that are not targeted by a DAP.
$ kubectl get ds
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
datadog-agent 1 1 1 1 1 <none> 5m3s
datadogagentprofile-sample 1 1 1 1 1 <none> 44sdatadog-agentis the DaemonSet created by the default profiledatadogagentprofile-sampleis the DaemonSet created by the profiledatadogagentprofile-sample
Common scenarios:
- Heterogeneous clusters with varying CPU core counts. A single global resource limit set on the
DatadogAgentis either too low for small control-plane nodes or too high for large GPU/bare-metal nodes. Use one DatadogAgentProfile (DAP) per node shape (selected viaprofileAffinityon a label such asnode.kubernetes.io/instance-typeor a custom node-role label) to apply appropriateresources.limits.cpuandresources.limits.memoryto each group. On nodes with a high logical CPU count, an explicit CPU limit also prevents the Agent's Go runtime from sizing its scheduler to the host CPU count, which can otherwise lead to OOM kills. - Targeting specific node roles. Run a different Agent configuration (for example, additional checks or a higher log level) on nodes labeled for a particular workload.
- Operator v1.5.0+
- Tests were performed on Kubernetes versions >=
1.27.0
DAP is disabled by default. To enable DAP using the datadog-operator helm chart, set in your values.yaml or as a flag in the command line arguments using --set:
datadogAgentProfile.enabled=true: this instructs the Operator deployment to start theDatadogAgentProfilecontroller.datadogCRDs.crds.datadogAgentProfiles=true: this installs theDatadogAgentProfileCRD.
For OLM deployments where container args cannot be set, enable the controller
via environment variable in the Subscription:
config:
env:
- name: DD_AGENT_PROFILE_CONTROLLER_ENABLED
value: "true"Caution
Enabling DAP will increase the resource usage of the Operator. Please ensure the operator pod has enough resources allocated to it prior to enabling DAP.
| Setting | Operator Version |
|---|---|
| override.[nodeAgent].containers.[*].resources.* | v1.5.0 |
| override.[nodeAgent].priorityClassName | v1.6.0 |
| override.[nodeAgent].containers.[*].env | v1.8.0 |
| override.[nodeAgent].labels | v1.8.0 |
| override.[nodeAgent].updateStrategy | v1.9.0 |
| override.[nodeAgent].runtimeClassName | v1.12.0 |
| override.[nodeAgent].volumes | v1.29.0 |
| override.[nodeAgent].containers.[*].volumeMounts | v1.29.0 |