Resource Requests, Limits and QoS Classes
Requests are what the scheduler reserves. Limits are what the kernel enforces. The relationship between them assigns a QoS class you never write down, and that class decides who gets evicted first. Build all three classes, then watch a container exceed its memory limit and get killed.
Configuration and Secrets Guide 35 of 103 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 30 min
Node utilisation figures are whatever your cluster is doing at the time. The QoS assignments and the OOM behaviour are deterministic.
- metrics-serverinstalled
| 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 you have to decide what goes in requests and what goes in limits. This matters because they do completely different jobs - one reserves capacity at scheduling time, the other is enforced at runtime - and together they silently decide which Pod is evicted first.
- telling a reservation from a ceiling, and seeing where each one is enforced
- reading the QoS class Kubernetes derived that you never wrote - Guaranteed, Burstable, BestEffort
- comparing what the scheduler reserved with what the node is actually using
- giving a container a 64Mi limit, asking it to write 200Mi, and reading the OOMKilled reason back
Before you start
- A working cluster and
kubectl. - The Pods guide. Requests and limits are fields on a container, so that is the shape you need.
metrics-serverif you wantkubectl topto work. It is not required for anything else here.
-
Two numbers that do completely different jobs
-
The class you never wrote
-
What the scheduler actually reserved
-
A memory limit is not advice
-
Clean up