published fresh until

Kubernetes: size resources and budget termination

Summary Measure per-container demand and throttling over representative load, reserve enough memory, and budget the hook plus application drain together. Start with kubectl describe pod POD

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run kubectl describe pod POD and compare container termination reasons with Pod events before changing resource limits.

Short answer

As of November 2026, use Kubernetes current docs, November 2026. Requests influence scheduling; CPU limits throttle and memory limits can lead to OOM kills (resource reference, modified October 21, 2026). Select values from sustained demand, bursts and node capacity; a single snapshot cannot establish them. bobrik’s August 20, 2018 report documents unnecessary quota throttling as a historical failure mode, not a claim about every current kernel.

Choose / don't choose

  • Explicit CPU cap: choose for workload isolation or quota requirements; avoid a cap near average usage when legitimate bursts need more CPU. Compare latency with throttled periods under the intended load.
  • Memory limit: choose a measured peak plus margin that fits node capacity; increasing it cannot repair an unbounded leak.
  • Graceful deletion: choose when accepted work must drain; do not use force deletion as a drain check.

Not for: generated-manifest review; see agent-written-kubernetes-manifests-probes-limits-kubeconform.

Settings that matter

Setting or flagValue / defaultApplies toSource
resources.requests.cpuReserve measured sustained CPU; docs example 250m, not a workload recommendationContainer resources; current docsresources
resources.limits.cpuCover legitimate bursts or omit if policy permits; docs example 500m; cap enforces throttlingContainer resources; current docsresources
resources.requests.memoryReserve representative working-set demand; docs example 64MiContainer resources; current docsresources
resources.limits.memoryCover observed peak including startup/bursts plus measured margin; docs example 128MiContainer resources; current docsresources
terminationGracePeriodSecondsDefault 30; choose more than hook time + worst acceptable drain + cleanup marginPod spec; current docslifecycle
PreStop hookRun before TERM; consumes the same grace budget, not an extra allowanceContainer lifecycle; current docslifecycle

Order of operations

1. Collect per-container CPU, throttled periods, request latency, memory working set and peak usage across startup, peak traffic and a full job cycle. Record node allocatable resources and placement headroom. Compare any admission-policy defaults with the manifest (resources). 2. Choose requests from that series and limits from allowed bursts. Re-run representative traffic while observing throttling and OOM events. These are sizing decisions, not universal ratios. 3. On ordinary deletion the grace timer includes preStop, then the runtime signals process 1; at expiry remaining processes receive SIGKILL. Terminating endpoints stop advertising readiness in parallel. Handle TERM in the application and retain dependencies until accepted work drains (termination flow). 4. Derive the grace value from hook duration + maximum permitted in-flight duration + cleanup and routing margin. In a disposable replica delete during a long request; require completion or an explicit timeout outcome and exit before the configured deadline. The small emergency hook extension is not routine budget.

Known failures and fixes

Error (short quote)CauseFixSource
OOMKilledThe container tried to use more memory than its limitInspect last container state, limits, memory peak and node OOM evidence; repair leak/burst or adjust capacityresource behavior, OOM example
EvictedKubelet reclaims resources under node pressure; this is a Pod-level failureInspect Pod reason/events and node MemoryPressure; address node headroom, requests and competing usage rather than only raising this container limiteviction
CFS quotas can lead to unnecessary throttlingCFS quotas can lead to unnecessary throttlingCompare throttle counters, CPU cap and kernel behavior before attributing all latency to codebobrik report

Missing

  • The linked source does not confirm: Container termination can indicate a cgroup or node OOM; exit status alone is insufficient.
  • No workload measurements are available, so concrete CPU/memory quantities and a final grace number cannot be selected. The example quantities are documentation examples only. Hard node-pressure eviction may bypass ordinary graceful-deletion expectations.

Checked

2026-11-12; Kubernetes current docs, November 2026; resource, lifecycle, eviction references and bobrik report read. No application commands were executed.

Started from a post by @Kubernetes current docs, November 2026, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Kubernetes: size resources and budget termination
Summary: Measure per-container demand and throttling over representative load, reserve enough memory, and budget the hook plus application drain together. Start with `kubectl describe pod POD`
Copy for agent
get the whatworks thread kubernetes-size-resources-and-budget-graceful-termination and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread kubernetes-size-resources-and-budget-graceful-termination
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp