Skip to content

Commit ee96187

Browse files
domalessirtrieu
andauthored
Add page on init container resource calc (#30456)
* add init resource calc page under guides * add new guide as a further reading link on k8s ssi home page * Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <[email protected]> * Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <[email protected]> * Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <[email protected]> * Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <[email protected]> * Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <[email protected]> * Update content/en/tracing/guide/init_resource_calc.md --------- Co-authored-by: Rosa Trieu <[email protected]>
1 parent c5a0e84 commit ee96187

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Init Container Resource Usage
3+
description: Learn how Datadog Agent v7.60+ automatically manages resource allocation for init containers that set up tracing, ensuring reliable tracer startup without impacting pod scheduling.
4+
disable_toc: false
5+
---
6+
7+
### Overview
8+
9+
Starting in Agent [v7.60+][1], Datadog uses dynamic resource calculation for init containers that inject tracing libraries. Instead of using fixed values, the init containers temporarily request all available CPU and memory for the pod, without affecting how the pod is scheduled. (Prior to v7.60, init containers used conservative defaults: `50m` for CPU and `20Mi` for memory.)
10+
11+
This behavior improves tracer startup reliability while respecting Kubernetes scheduling rules. Since init containers run sequentially and exit before application containers start, they don't compete for runtime resources.
12+
13+
### Pod scheduling
14+
15+
Kubernetes schedules pods using a formula that accounts for init containers:
16+
17+
<div style="text-align:center">
18+
<pre><code>
19+
Effective CPU/Memory request =
20+
max(sum of requests from all regular containers,
21+
max request of any single init container)
22+
</code></pre>
23+
</div>
24+
25+
Since init containers run before application containers (and don't overlap with them), they can temporarily use more resources without increasing the pod's effective request. This works as long as no single init container requests more resources than the pod can tolerate.
26+
27+
### Override default behavior
28+
29+
If needed, you can override the default init container resource usage by setting the following environment variables in the Cluster Agent configuration:
30+
- `DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_INIT_RESOURCES_CPU`
31+
- `DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_INIT_RESOURCES_MEMORY`
32+
33+
[1]: https://github.com/DataDog/datadog-agent/blob/40f0be0645ae309a07031bd7954fd58a8eb79853/pkg/clusteragent/admission/mutate/autoinstrumentation/auto_instrumentation.go#L611-L626

content/en/tracing/trace_collection/automatic_instrumentation/single-step-apm/kubernetes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ further_reading:
77
- link: /tracing/metrics/runtime_metrics/
88
tag: Documentation
99
text: Enable Runtime Metrics
10+
- link: /tracing/guide/init_resource_calc/
11+
tag: Documentation
12+
text: Learn about init container resource usage
1013
---
1114

1215
## Overview

0 commit comments

Comments
 (0)