Pcornel
Containers · Scheduling, Resources & Health

Resource Requests and Limits

Cheat sheet · https://pcornel.dk/topic.php?topic=6153

Back to the Topic

Answer

Requests reserve CPU and memory for scheduling; limits cap usage. CPU over limit is throttled; memory over limit is OOM-killed. QoS classes (Guaranteed, Burstable, BestEffort) affect eviction.

Remember

Set requests from observed usage (kubectl top, metrics). Memory limits protect nodes; many teams avoid CPU limits to prevent throttling. LimitRanges and ResourceQuotas set namespace defaults/caps.

First checks

  • kubectl top pod — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events

Commands

kubectl top pod

Verify in this order

requests → scheduling; limits → cgroup enforcement → throttle/OOM

Where it usually breaks

Requests set far above usage waste capacity and block scheduling.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6153

Confirmation

Confirm action

Continue?