A request reserves. A limit caps. The two live side by side:
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 500m
memory: 128MiThe container is scheduled as if it used 100m and 64Mi. At runtime it may grow to 500m and 128Mi. Past that, the two resources behave differently.
CPU is throttled
CPU is time on a core. A container above its CPU limit is held back by the kernel until the next slice. It gets slower; it does not die. A throttled app shows up as latency, not as restarts.
Memory is killed
Memory cannot be slowed down. When a container passes its memory limit the kernel's OOM killer ends the process:
kubectl describe pod records it under the previous run:
Last State: Terminated
Reason: OOMKilled
Exit Code: 137137 is 128 plus signal 9, SIGKILL. The logs usually end mid-sentence, because the process got no chance to say anything.
Changing it
kubectl set resources deploy/market-api --limits=memory=256Mi --requests=memory=128Mi
kubectl top podsset resources edits the Deployment's template; the rollout replaces the Pods. top shows what a Pod uses right now, which is the number a limit has to stay above.