Skip to content

Add page on init container resource calc #30456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions content/en/tracing/guide/init_resource_calc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Init Container Resource Usage
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.
disable_toc: false
---

### Overview

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.)

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.

### Pod scheduling

Kubernetes schedules pods using a formula that accounts for init containers:

<div style="text-align:center">
<pre><code>
Effective CPU/Memory request =
max(sum of requests from all regular containers,
max request of any single init container)
</code></pre>
</div>

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.

### Override default behavior

If needed, you can override the default init container resource usage by setting the following environment variables in the Cluster Agent configuration:
- `DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_INIT_RESOURCES_CPU`
- `DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_INIT_RESOURCES_MEMORY`

[1]: https://github.com/DataDog/datadog-agent/blob/40f0be0645ae309a07031bd7954fd58a8eb79853/pkg/clusteragent/admission/mutate/autoinstrumentation/auto_instrumentation.go#L611-L626
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ further_reading:
- link: /tracing/metrics/runtime_metrics/
tag: Documentation
text: Enable Runtime Metrics
- link: /tracing/guide/init_resource_calc/
tag: Documentation
text: Learn about init container resource usage
---

## Overview
Expand Down
Loading