Pods request 2 CPU and 4 GiB each but use 200m and 600 MiB. How do you right-size without causing OOMs?

IntermediateScenarioCost
Answer

Situation read → Teams over-request out of fear. Right-sizing must be based on real peaks, not averages, and must be rolled out carefully.

What I'd do →

  1. Measure over at least two weeks, including peak traffic:
quantile_over_time(0.95, rate(container_cpu_usage_seconds_total{namespace="shop",container="api"}[5m])[14d:5m])
max_over_time(container_memory_working_set_bytes{namespace="shop",container="api"}[14d])
  1. Set CPU request near p95 usage. Set memory request and limit from the max working set plus 20–30% headroom.
  2. Use VPA in Off (recommendation) mode as a second opinion.
  3. Roll out per service, watching OOMKilled counts, throttling and latency for a week.
  4. Make it continuous: a monthly report of the biggest gaps between request and usage.

Why → Memory is incompressible, so it's sized on peak; CPU is compressible, so slight under-sizing only causes throttling.

Interview tip → Use container_memory_working_set_bytes; it's what the kubelet uses for eviction and OOM decisions.

All Real-World Interview questions Roadmap: Interview readiness

More on Cost