Two numbers per resource, per container.
text
requests limits
cpu what the scheduler reserves throttled above this
memory what the scheduler reserves killed above this (OOMKilled, exit 137)yaml
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 500m
memory: 128Mi100m is 0.1 CPU. 64Mi is 64 mebibytes.
What the node sees
text
node capacity 2 CPU, 3.7Gi
├── market-web requests 100m / 32Mi
├── market-api requests 250m / 64Mi
└── market-db requests 500m / 256Mi
free 1150m / ~3.3Gi ← a Pod requesting more than this stays PendingQoS classes
| Class | Condition | Evicted |
|---|---|---|
| Guaranteed | requests == limits for cpu and memory on every container | last |
| Burstable | some requests or limits set | middle |
| BestEffort | nothing set | first |
Read it with kubectl get pod <pod> -o jsonpath='{.status.qosClass}' or in kubectl describe pod.
Commands
sh
kubectl set resources deploy/market-api --limits=memory=128Mi --requests=memory=64Mi
kubectl top pods
kubectl describe pod <pod>set resources edits the Deployment template and rolls out new Pods. top shows current usage. describe shows Limits:, Requests: and, after a kill, Last State: Terminated, Reason: OOMKilled, Exit Code: 137.
text
container uses 64Mi
limit 32Mi
│ 3 s after start
OOMKilled (137) → restart → OOMKilled → CrashLoopBackOffCPU is different: a container above its CPU limit is throttled, not killed.