A container with limits.cpu: 500m gets a burst and wants two full cores for a few hundred milliseconds. What happens to it, and is that the same thing that happens when it exceeds its memory limit?
- The kubelet evicts the pod for exceeding its CPU limit. Node-pressure eviction is about memory, disk, and PIDs; CPU over-use is handled by throttling.
- It is throttled: the CFS quota lets it run 50 ms of every 100 ms period and it waits for the rest, so latency rises but nothing is killed. CPU is a compressible resource; the kernel enforces the limit by pausing the cgroup once its quota for the period is spent.
- The scheduler moves the pod to a node with more free CPU. Scheduling happens once; nothing moves running pods for resource reasons.
- It is OOMKilled with exit code 137. OOMKill is a memory mechanism; CPU limits never kill.
The container is throttled to 50 ms of CPU every 100 ms, so latency rises but nothing is killed.
CPU limits are enforced by the CFS bandwidth controller: cpu.max grants a quota per 100 ms period, and a multi-threaded process can exhaust a 500m quota in 25 ms across two threads, then sit idle for 75 ms. That is why services can show low average CPU and high p99 latency at the same time. Interviewers look for "throttled, not killed" and for knowing where to see it (container_cpu_cfs_throttled_periods_total).
Saying the container is OOMKilled or evicted for exceeding CPU. CPU is compressible and is paused until the next period; only memory limits kill, and only node pressure evicts.