Right-sizing Kubernetes requests and limits
How to pick CPU and memory values that keep workloads stable without paying for idle capacity.
Requests decide scheduling. Limits decide throttling and eviction. Confusing the two is the most common reason a cluster looks full while nodes sit at 20% utilization.
Measure before you guess
Start from actual usage over a period that includes your worst traffic day.
kubectl top pods --containers --sum
Use the p95 of CPU and the max of memory. CPU is compressible, memory is not, so the two need different safety margins.
A practical starting point
| Resource | Request | Limit |
|---|---|---|
| CPU | p95 usage | 2-4x request or unset |
| Memory | max usage + 20% | same as request |
Setting memory limit equal to request gives the pod a Guaranteed QoS class, which makes eviction
behavior predictable.
Keep it honest over time
Re-check sizing whenever the workload changes shape: a new caching layer, a different serialization format, or a runtime upgrade can move both numbers significantly.
Topics