Skip to content

Commit 85dfd6d

Browse files
authored
Merge pull request DataDog#15180 from DataDog/eddy/k8-lib-injection
Update admission_controller.md
2 parents 47567ba + 7891d0b commit 85dfd6d

File tree

2 files changed

+62
-19
lines changed

2 files changed

+62
-19
lines changed

content/en/containers/cluster_agent/admission_controller.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,47 @@ Finally, run the following commands:
128128
- `kubectl apply -f agent-services.yaml`
129129
- `kubectl apply -f cluster-agent-deployment.yaml`
130130

131-
### APM and DogStatsD
132131

133-
To configure DogstatsD clients and APM tracers automatically, inject the environment variables `DD_AGENT_HOST` and `DD_ENTITY_ID` by using one of the following:
132+
### APM
133+
You can configure the Cluster Agent (version 7.39 and higher) to inject APM tracing libraries automatically.
134134

135+
After you install the Cluster Agent, do one of the following:
135136
- Add the label `admission.datadoghq.com/enabled: "true"` to your pod.
136137
- Configure the Cluster Agent admission controller by setting `mutateUnlabelled` (or `DD_ADMISSION_CONTROLLER_MUTATE_UNLABELLED`, depending on your configuration method) to `true`.
137138

139+
To opt-in your container for library injection, use Pod annotations inside your application's YAML file to specify language tracers and versions.
140+
141+
142+
The annotations are a `key: value` pair in the following format:
143+
144+
```yaml
145+
datadoghq.com/<language>-lib.version: <lib-version>
146+
```
147+
148+
Adding a this annotation results in the injection of the tracer library for that language and version into the containerized application.
149+
Valid `<language>` values are:
150+
- `java`
151+
- `js`
152+
- `python`
153+
154+
For example to inject the latest Java tracer:
155+
156+
```yaml
157+
annotations:
158+
datadoghq.com/java-lib.version: "latest"
159+
```
160+
161+
**Note**: Use caution specifying `latest` as major library releases can introduce breaking changes.
162+
163+
Although it's an uncommon scenario, you can add multiple `<language>-lib.version` annotations to inject multiple language tracers into one container.
164+
165+
For example to inject the latest Java tracer and Node tracer v3.0.0:
166+
```yaml
167+
annotations:
168+
datadoghq.com/java-lib.version: "latest"
169+
datadoghq.com/js-lib.version: "3.0.0"
170+
```
171+
138172
To prevent pods from receiving environment variables, add the label `admission.datadoghq.com/enabled: "false"`. This works even if you set `mutateUnlabelled: true`.
139173

140174
Possible options:
@@ -148,6 +182,12 @@ Possible options:
148182
| `false` | `admission.datadoghq.com/enabled=true` | Yes |
149183
| `false` | `admission.datadoghq.com/enabled=false` | No |
150184

185+
### DogStatsD
186+
187+
To configure DogStatsD clients or other APM libraries that do not support library injection, inject the environment variables `DD_AGENT_HOST` and `DD_ENTITY_ID` by doing one of the following:
188+
- Add the label `admission.datadoghq.com/enabled: "true"` to your pod.
189+
- Configure the Cluster Agent admission controller by setting `mutateUnlabelled` (or `DD_ADMISSION_CONTROLLER_MUTATE_UNLABELLED`, depending on your configuration method) to `true`.
190+
151191

152192
#### Order of priority
153193
The Datadog admission controller does not inject the environment variables `DD_VERSION`, `DD_ENV`, and `DD_SERVICE` if they already exist.

content/en/containers/kubernetes/apm.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,29 +218,31 @@ kind: Deployment
218218
```
219219
**Note:** This configuration requires the Agent to be configured to accept traces over TCP
220220

221-
[1]: /agent/cluster_agent/admission_controller/
222221

222+
[1]: /agent/cluster_agent/admission_controller/
223223
{{% /tab %}}
224224

225225
{{< /tabs >}}
226226

227227
### Configure your application tracers to emit traces:
228228
After configuring your Datadog Agent to collect traces and giving your application pods the configuration on *where* to send traces, install the Datadog Tracer into your applications to emit the traces. Once this is done, the tracer automatically sends the traces to the relative `DD_AGENT_HOST` (for `IP:Port`) or `DD_TRACE_AGENT_URL` (for UDS) endpoint.
229229

230-
Refer to the [language-specific APM instrumentation docs][2] for more examples.
230+
For information about auto-injection of the libraries for supported languages, read [the APM section of the Admission Controller documentation][2].
231+
232+
Refer to the [language-specific APM instrumentation docs][3] for more examples.
231233

232234

233235
## Agent environment variables
234236

235-
**Note**: As a best practice, Datadog recommends using unified service tagging when assigning tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: `env`, `service`, and `version`. To learn how to configure your environment with unified tagging, refer to the dedicated [unified service tagging][3] documentation.
237+
**Note**: As a best practice, Datadog recommends using unified service tagging when assigning tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: `env`, `service`, and `version`. To learn how to configure your environment with unified tagging, refer to the dedicated [unified service tagging][4] documentation.
236238

237239
List of all environment variables available for tracing within the Agent running in Kubernetes:
238240

239241
| Environment variable | Description |
240242
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
241-
| `DD_API_KEY` | [Datadog API Key][2] |
243+
| `DD_API_KEY` | [Datadog API Key][3] |
242244
| `DD_PROXY_HTTPS` | Set up the URL for the proxy to use. |
243-
| `DD_APM_REPLACE_TAGS` | [Scrub sensitive data from your span’s tags][4]. |
245+
| `DD_APM_REPLACE_TAGS` | [Scrub sensitive data from your span’s tags][5]. |
244246
| `DD_HOSTNAME` | Manually set the hostname to use for metrics if autodetection fails, or when running the Datadog Cluster Agent. |
245247
| `DD_DOGSTATSD_PORT` | Set the DogStatsD port. |
246248
| `DD_APM_RECEIVER_SOCKET` | Collect your traces through a Unix Domain Sockets and takes priority over hostname and port configuration if set. Off by default, when set it must point to a valid sock file. |
@@ -252,17 +254,17 @@ List of all environment variables available for tracing within the Agent running
252254
| `DD_APM_RECEIVER_PORT` | Port that the Datadog Agent's trace receiver listens on. Default value is `8126`. |
253255
| `DD_APM_NON_LOCAL_TRAFFIC` | Allow non-local traffic when tracing from other containers. Default value is `true` (Agent 7.18+) |
254256
| `DD_APM_IGNORE_RESOURCES` | Configure resources for the Agent to ignore. Format should be comma separated, regular expressions. Like <code>GET /ignore-me,(GET\|POST) /and-also-me</code>. |
255-
| `DD_ENV` | Sets the global `env` for all data emitted by the Agent. If `env` is not present in your trace data, this variable is used. See [APM environment setup][5] for more details.
257+
| `DD_ENV` | Sets the global `env` for all data emitted by the Agent. If `env` is not present in your trace data, this variable is used. See [APM environment setup][6] for more details.
256258

257259

258260
### Operator environment variables
259261
| Environment variable | Description |
260262
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
261-
| `agent.apm.enabled` | Enable this to enable APM and tracing, on port 8126. See the [Datadog Docker documentation][6]. |
262-
| `agent.apm.env` | The Datadog Agent supports many [environment variables][7]. |
263+
| `agent.apm.enabled` | Enable this to enable APM and tracing, on port 8126. See the [Datadog Docker documentation][7]. |
264+
| `agent.apm.env` | The Datadog Agent supports many [environment variables][8]. |
263265
| `agent.apm.hostPort` | Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If `HostNetwork` is specified, this must match `ContainerPort`. Most containers do not need this. |
264-
| `agent.apm.resources.limits` | Limits describes the maximum amount of compute resources allowed. For more info, see the [Kubernetes documentation][8]. |
265-
| `agent.apm.resources.requests` | Requests describes the minimum amount of compute resources required. If `requests` is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. For more info, see the [Kubernetes documentation][8]. | |
266+
| `agent.apm.resources.limits` | Limits describes the maximum amount of compute resources allowed. For more info, see the [Kubernetes documentation][9]. |
267+
| `agent.apm.resources.requests` | Requests describes the minimum amount of compute resources required. If `requests` is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. For more info, see the [Kubernetes documentation][9]. | |
266268

267269

268270
## Further Reading
@@ -271,10 +273,11 @@ List of all environment variables available for tracing within the Agent running
271273

272274

273275
[1]: /agent/kubernetes/
274-
[2]: /tracing/setup/
275-
[3]: /getting_started/tagging/unified_service_tagging
276-
[4]: /tracing/guide/security/#replace-rules
277-
[5]: /tracing/guide/setting_primary_tags_to_scope/#environment
278-
[6]: https://github.com/DataDog/docker-dd-agent#tracing-from-the-host
279-
[7]: https://docs.datadoghq.com/agent/docker/?tab=standard#environment-variables
280-
[8]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
276+
[2]: /containers/cluster_agent/admission_controller/#apm
277+
[3]: /tracing/setup/
278+
[4]: /getting_started/tagging/unified_service_tagging
279+
[5]: /tracing/guide/security/#replace-rules
280+
[6]: /tracing/guide/setting_primary_tags_to_scope/#environment
281+
[7]: https://github.com/DataDog/docker-dd-agent#tracing-from-the-host
282+
[8]: https://docs.datadoghq.com/agent/docker/?tab=standard#environment-variables
283+
[9]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/

0 commit comments

Comments
 (0)