Skip to main content
Kubernetes Resource Requests: Right-Sizing Without Guessing

Kubernetes Resource Requests: Right-Sizing Without Guessing

KU
· Founder & Chief Editor
• 8 min read•Updated •

Bad resource requests waste money or trigger OOMs. The methodology we use to right-size requests based on actual usage, and the gotchas the autoscalers don't fix.

Key takeaways

  • Right-size Kubernetes requests from measured usage, not copied defaults.
  • Pull 14 days of data, set CPU requests near 1.2 times p95 usage and memory requests near 1.15 times peak working set, then observe for a week.
  • Run the Vertical Pod Autoscaler in Off mode for recommendations and keep a human reviewing the changes.

Right-size Kubernetes requests from 14 days of measured usage: set CPU requests near 1.2 times p95 usage, memory requests near 1.15 times the peak working set, and memory limits above that peak. Run the Vertical Pod Autoscaler in Off mode for the same numbers as recommendations, apply them by hand, then watch evictions, OOM kills and throttling for a week.

Verified againstChecked against official docs

Kubernetes 1.37 (in-place Pod resize stable since 1.35), Vertical Pod Autoscaler 1.8.1, against the kubernetes.io resource management, Pod QoS and feature-gate pages and the VPA quick start. Checked October 2026.

Requests look like a simple setting and quietly cost a lot. Too low and pods get evicted or OOM-killed. Too high and you pay for capacity nobody uses. Most teams pick numbers by hand once, never revisit them, and the gap between request and reality grows every quarter. The methodology below is unglamorous and has no auto-magic, which is why it works.

What requests and limits actually do

  • resources.requests is what the scheduler uses to decide whether a pod fits on a node. It is a reservation: that much CPU and memory is set aside for the pod whatever it actually uses.
  • resources.limits is the cap. A container that exceeds its memory limit is OOM-killed by the kernel; CPU above the limit is throttled.

Requests drive cost, because you pay for reserved capacity even when the pod is idle. Limits drive containment, because a runaway pod can't starve its neighbors.

The most common misconfiguration is request equal to limit everywhere. That is sometimes correct for latency-critical workloads and far more often a defensive guess that wastes capacity.

The data you actually need

Before changing anything, gather per-pod usage over a realistic window:

  • CPU: the p95 and p99 of CPU usage over the last 14 days.
  • Memory: the maximum, not the p95, of the working set over the same window.

The two resources behave differently. CPU is compressible: going over your request briefly means competing for spare cycles, not dying, so the request can sit near p95. Memory is not compressible: going over the limit gets the container killed with exit code 137 (see Kubernetes exit codes), so the limit must clear your worst case.

We pull these from Prometheus with cAdvisor and kube-state-metrics. CPU usage is a counter, so take a rate first and run the quantile over a subquery:

PromQL
# CPU cores, p95 over 14 days, per container
quantile_over_time(0.95,
  rate(container_cpu_usage_seconds_total{namespace="payments", container!=""}[5m])[14d:5m])

# Peak memory working set over 14 days, per container
max_over_time(container_memory_working_set_bytes{namespace="payments", container!=""}[14d])

The methodology, per service

  1. Pull 14 days of usage data: CPU p95 and memory max per container.
  2. Set the CPU request to about 1.2 times p95 and the memory request to about 1.15 times the peak. The buffer absorbs spikes and growth.
  3. Set the memory limit to about 1.5 times the request. Leave the CPU limit unset if the workload tolerates sharing, or set it around 3 times the request if you need a ceiling.
  4. Deploy and observe for a week: evictions, OOM kills, throttling rate.
  5. Adjust once if needed. One iteration is usually enough.

Aggressive teams skip the buffer and run at exactly p95. We've found the buffer pays for itself, because without it ordinary day-to-day variance triggers evictions and pages. The big shift is cultural: stop copying the request from another service's manifest and use the data.

What we keep finding

Most services are over-requested. A copy-paste default such as requests: {cpu: 500m, memory: 512Mi} becomes the house standard, while actual usage for many services sits at a fraction of that.

A few services are under-requested. Usually older ones whose load grew while nobody touched the manifest. They run well above their request, get throttled constantly, and the team has accepted that "this service is just slow".

Requests pinned to oversized limits. limits.memory: 2Gi on a service that uses 200Mi is harmless by itself. Setting the request to the same 2Gi is what wastes the node.

JVM heaps sized off the limit. The JVM derives its default maximum heap from the container memory limit, not from what the app needs. Set -XX:MaxRAMPercentage or -Xmx explicitly so heap tracks real demand, then right-size the container around it.

Tools that help

Vertical Pod Autoscaler in Off mode. The VPA quick start describes Off as calculating recommendations without changing pods. Those recommendations are the numbers you would compute yourself, packaged in the VPA object. Run it on every namespace and feed its output into the manual process.

We still don't let VPA apply changes on its own for most services. As of the VPA docs checked in October 2026, Auto is deprecated in favour of explicit modes: Recreate evicts pods to apply new requests, InPlaceOrRecreate uses in-place resize and falls back to eviction, and InPlace never evicts. In-place resize removes the restart cost, but recommendations for bursty workloads can still swing. Recommendations plus human review remains our default.

OpenCost (or Kubecost, built on it) attributes cost per workload. It turns "this service is over-provisioned" into a dollar figure a team lead can act on.

Goldilocks sits on top of VPA and renders current versus recommended requests per workload. Useful for periodic reviews, unnecessary if you already query VPA objects directly.

When request equal to limit is correct

  • Latency-sensitive workloads. Equal requests and limits for CPU and memory on every container give the pod the Guaranteed QoS class. The Kubernetes docs say those pods are evicted last under node pressure and can use exclusive CPUs with the static CPU management policy.
  • One pod per node services, where the node is the pod and right-sizing is moot.
  • Noisy-neighbor sensitive workloads where CPU contention is unacceptable.

Set request equal to limit because the workload needs it, never because of a copy-paste.

Where right-sizing doesn't help

HPA-managed services bottlenecked on replica count. If the autoscaler keeps adding pods, you have a scaling problem, not an over-request problem.

Bimodal usage. Idle most of the day, bursting at peak. Sizing to average starves the peak; sizing to peak wastes the rest. Use HPA for replicas or accept some waste for predictability.

Cold-start sensitive apps such as slow-booting JVM services. Aggressive cuts cause scaling churn. Stay conservative.

What we measure afterwards

  • Allocation versus usage for cluster CPU and memory. The gap should shrink.
  • Evictions due to resource pressure. Should stay near zero; a spike means we over-trimmed.
  • OOM kills per workload. Should be zero. If a pod is OOM-killed, raise its memory limit and probably its request.
  • CPU throttling rate. Some is fine for batch work; sustained high throttling means the request or limit is too low.

Questions people ask

Should I set CPU limits in Kubernetes?

Often no. CPU is compressible, so a container over its request competes for spare cycles instead of being killed, while a CPU limit throttles it even when the node is idle. Leave limits off for most services and size requests from p95 usage. Set CPU limits when you need a hard ceiling, for example a multi-tenant cluster, or request equal to limit for Guaranteed QoS.

Is it safe to run VPA in Auto mode?

Auto is deprecated in the current VPA docs and behaves like Recreate, which evicts pods to apply new requests. With in-place Pod resize stable since Kubernetes 1.35, InPlaceOrRecreate and InPlace reduce that disruption, but recommendations can still swing on bursty workloads. We run Off mode everywhere and apply recommendations through review, then consider in-place modes for steady, well-understood services.

How often should I revisit resource requests?

Quarterly for most services, and immediately after a significant traffic or code change. Workloads drift, and a request set a year ago is usually wrong in one direction or the other. Start with the five most expensive workloads, since that is where the money is, and never change requests during an incident.

Common mistakes

Trusting the vendor's sizing note. "Requires 2GB memory" is usually conservative. Measure.

Right-sizing once. Revisit every quarter for services whose usage has shifted.

Right-sizing without monitoring. No per-pod usage data means you are guessing. Wire up metrics first.

Cutting during an incident. Right-sizing is quiet-time work.

For a first pass before you have VPA data, the Kubernetes resource calculator turns observed average and peak usage into starting requests and limits.

Right-sizing isn't exotic. It is the measure-and-adjust work most teams skip, a few hours per service per quarter, and among the best returns per engineering hour we know.

Sources

Explore topics:KubernetesCloud
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Kubernetes Resource Requests: Right-Sizing Without Guessing. DevOpsNess. Updated 2026-11-20. https://www.devopsness.com/blog/kubernetes-resource-requests-rightsizing

Markdown

[Kubernetes Resource Requests: Right-Sizing Without Guessing](https://www.devopsness.com/blog/kubernetes-resource-requests-rightsizing) (Kiril Urbonas, DevOpsNess, updated 2026-11-20)

KU

Kiril Urbonas

Founder & Chief Editor

607 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.