Resource Requests and Limits
On this page
Why Requests/Limits Matter
- Scheduler uses requests; runtime enforces limits.
- Bad settings cause Pending pods, throttling, and OOMKills.
Quick Inspection
kubectl -n <ns> get pod <pod> -o jsonpath='{"REQ: "}{.spec.containers[*].resources.requests}{"
LIM: "}{.spec.containers[*].resources.limits}{"
"}'
kubectl -n <ns> describe pod <pod> | grep -i -E 'Requests|Limits|OOM|Killed' -n || true
Detect OOMKills
kubectl -n <ns> get pod <pod> -o jsonpath=' {.status.containerStatuses[0].lastState.terminated.reason}{"
"}'
kubectl -n <ns> describe pod <pod> | grep -i -E 'oom|killed' -n || true
Right-Sizing Workflow
- Start with conservative requests; observe real usage.
- Raise memory limit above peak; avoid frequent OOM.
- Set CPU limits carefully to avoid throttling critical paths.
Failure Modes
- Pending: requests too high for cluster capacity.
- CPU throttling: high latency under load due to tight CPU limit.
- OOMKilled: memory limit below peak usage.