Resource Requests, Limits and OOMKilled
Requests are what the scheduler reserves; limits are what the kernel enforces. The asymmetry that catches people is between the two resources: memory is incompressible so exceeding its limit kills the container, while CPU is compressible so exceeding its limit just makes it slower. Both are reproduced here, along with the three QoS classes those numbers put a Pod into.
Configuration and Security Guide 26 of 44 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 16 min
Exit code 137 is 128 + 9, meaning the process was killed by SIGKILL. The kernel's OOM killer sends it and the kubelet reports OOMKilled. A container with restartPolicy: Always would restart and eventually reach CrashLoopBackOff with OOMKilled as the last state - the reason people see the loop and miss the cause.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a container is being killed or throttled and you have to say which. This matters because requests are what the scheduler reserves and limits are what the kernel enforces - memory kills the process, CPU only slows it down.
- running three Pods and reading the three QoS classes Kubernetes derives from them
- confirming what the scheduler actually reserved against the node's own accounting
- hitting a memory limit and reading exit 137, which is 128 plus SIGKILL
- hitting a CPU limit and finding that it throttles rather than kills
Before you start
- A cluster and kubectl.
- The session creates namespace
ckad-limwith three Pods of different QoS classes, one that deliberately exhausts a 32Mi memory limit, and one that spins against a CPU limit.
-
Three Pods, three QoS classes
-
What the scheduler actually reserved
-
The limit that kills
-
The limit that only slows you down