From b986c713a7ea8ac77ab5d6cf7a851089b461e15c Mon Sep 17 00:00:00 2001 From: Dominique Alessi Date: Mon, 14 Jul 2025 14:08:51 -0400 Subject: [PATCH 1/8] add init resource calc page under guides --- .../en/tracing/guide/init_resource_calc.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 content/en/tracing/guide/init_resource_calc.md diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md new file mode 100644 index 0000000000000..b09a9802e4eb3 --- /dev/null +++ b/content/en/tracing/guide/init_resource_calc.md @@ -0,0 +1,32 @@ +--- +title: Init container resource usage +disable_toc: false +--- + +### Overview + +Starting in Agent [v7.60+][1], Datadog uses dynamic resource calculation for init containers that inject tracing libraries. Instead of fixed values, the init containers temporarily request all available CPU and memory for the pod, without affecting how the pod is scheduled. (Prior 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. Init containers run sequentially and exit before application containers start, so they don't compete for runtime resources. + +### Pod scheduling + +Kubernetes schedules pods using a formula that accounts for init containers: + +
+

+Effective CPU/Memory request =
+  max(sum of requests from all regular containers,
+      max request of any single init container)
+
+
+ +Because init containers run before application containers (and don't overlap), they can temporarily use more resources without increasing the pod's effective request, as long as no single init container requests more than the pod can tolerate. + +### Override default behavior + +If needed, you can override 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 \ No newline at end of file From 1aa862cbe4908e069795c1671bec4ccc36c64dad Mon Sep 17 00:00:00 2001 From: Dominique Alessi Date: Mon, 14 Jul 2025 14:10:45 -0400 Subject: [PATCH 2/8] add new guide as a further reading link on k8s ssi home page --- .../automatic_instrumentation/single-step-apm/kubernetes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/en/tracing/trace_collection/automatic_instrumentation/single-step-apm/kubernetes.md b/content/en/tracing/trace_collection/automatic_instrumentation/single-step-apm/kubernetes.md index 51e75fc647098..b25a84219f0f9 100644 --- a/content/en/tracing/trace_collection/automatic_instrumentation/single-step-apm/kubernetes.md +++ b/content/en/tracing/trace_collection/automatic_instrumentation/single-step-apm/kubernetes.md @@ -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 From f3bd64823c66d6379aaf747ee31718dedc482726 Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:23:50 -0400 Subject: [PATCH 3/8] Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- content/en/tracing/guide/init_resource_calc.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index b09a9802e4eb3..f599627531e84 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -1,5 +1,6 @@ --- -title: Init container resource usage +title: Init Container Resource Usage +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 --- From ae6f9b037f0807d3a7da76e535c21dbcdad3c244 Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:24:15 -0400 Subject: [PATCH 4/8] Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- content/en/tracing/guide/init_resource_calc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index f599627531e84..034749b6a2a76 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -6,7 +6,7 @@ disable_toc: false ### Overview -Starting in Agent [v7.60+][1], Datadog uses dynamic resource calculation for init containers that inject tracing libraries. Instead of fixed values, the init containers temporarily request all available CPU and memory for the pod, without affecting how the pod is scheduled. (Prior v7.60, init containers used conservative defaults: `50m` for CPU and `20Mi` for memory.) +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. Init containers run sequentially and exit before application containers start, so they don't compete for runtime resources. From a2d6dd42e543c40c3abfa7c85a49ac2b34f703e5 Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:24:28 -0400 Subject: [PATCH 5/8] Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- content/en/tracing/guide/init_resource_calc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index 034749b6a2a76..7a9b317364068 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -8,7 +8,7 @@ disable_toc: false 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. Init containers run sequentially and exit before application containers start, so they don't compete for runtime resources. +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 From 67bc0cb33afb87c1233e9fd206a06f8140c8d4e7 Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:25:08 -0400 Subject: [PATCH 6/8] Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- content/en/tracing/guide/init_resource_calc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index 7a9b317364068..9fb7a46489d12 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -22,7 +22,7 @@ Effective CPU/Memory request = -Because init containers run before application containers (and don't overlap), they can temporarily use more resources without increasing the pod's effective request, as long as no single init container requests more than the pod can tolerate. +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 From b10f491b49206b67ed913b0feeb762f472eb6f0f Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:25:18 -0400 Subject: [PATCH 7/8] Apply suggestion from @rtrieu Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- content/en/tracing/guide/init_resource_calc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index 9fb7a46489d12..f58a46e7d6221 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -26,7 +26,7 @@ Since init containers run before application containers (and don't overlap with ### Override default behavior -If needed, you can override init container resource usage by setting the following environment variables in the Cluster Agent configuration: +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` From 6469013f925859ae8d669a6f9064e52d64eeb015 Mon Sep 17 00:00:00 2001 From: domalessi <111786334+domalessi@users.noreply.github.com> Date: Thu, 17 Jul 2025 12:50:03 -0400 Subject: [PATCH 8/8] Update content/en/tracing/guide/init_resource_calc.md --- content/en/tracing/guide/init_resource_calc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/tracing/guide/init_resource_calc.md b/content/en/tracing/guide/init_resource_calc.md index f58a46e7d6221..599f64213d079 100644 --- a/content/en/tracing/guide/init_resource_calc.md +++ b/content/en/tracing/guide/init_resource_calc.md @@ -1,6 +1,6 @@ --- title: Init Container Resource Usage -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. +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 ---