Appearance

Requests, limits, and QoS

Connect scheduler accounting to CPU throttling, memory failure, and eviction priority.

What you will understand

  • Predict scheduling from requests rather than observed usage
  • Distinguish CPU throttling from memory limit failure
  • Classify a Pod using QoS rules and their limits

Builds on: Your first debugging workflow

Mental model: admission, placement, and runtime answer different questions

A resource request is the amount Kubernetes uses when deciding whether a node has room for a Pod. It is not the Pod’s current usage. A resource limit constrains consumption at runtime through the node’s container runtime and operating system. A Pod requesting 250 millicores can use more CPU when capacity and its limit permit. The scheduler does not continually move it because usage changes. This distinction explains why a mostly idle cluster can still have Pending Pods: existing requests may already account for the allocatable capacity on every suitable node.

CPU is divisible execution time. 250m means one quarter of one CPU unit; it does not pin a thread to a particular core. Memory quantities such as 128Mi are bytes with binary suffixes. Node allocatable capacity excludes reservations and other node overhead from the capacity available for Pods. For ordinary containers, the scheduler considers their requests together, with additional rules for init containers and Pod overhead. Read the admitted Pod because defaults or admission mutation can change the submitted configuration.

A scheduling budget is not a usage meter

Trace a 200m request against allocatable CPU and then follow runtime CPU and memory enforcement.

Scheduling viewStep 1 of 4
Filter by requestsNode A has only 100m of its scheduling budget left; low observed CPU usage cannot make the 200m request fit.. New Pod, CPU request 200m; memory request 64Mi, active. Node A, 2 CPU allocatable; 1.9 CPU requested, warning. Node B, 2 CPU allocatable; 1.5 CPU requested, idle. CPU cgroup, CPU limit 500m, idle. Memory cgroup, Memory limit 128Mi, idleNew Pod: CPU request 200m; memory request 64Mi
New PodCPU request 200m; memory request 64MiIn focus
Node A: 2 CPU allocatable; 1.9 CPU requested
Node A2 CPU allocatable; 1.9 CPU requestedWarning
Node B: 2 CPU allocatable; 1.5 CPU requested
Node B2 CPU allocatable; 1.5 CPU requestedContext
CPU cgroup: CPU limit 500m
CPU cgroupCPU limit 500mContext
Memory cgroup: Memory limit 128Mi
Memory cgroupMemory limit 128MiContext
New PodCPU request 200m; memory request 64MiIn focus
Node A2 CPU allocatable; 1.9 CPU requestedWarning
Node B2 CPU allocatable; 1.5 CPU requestedContext
CPU cgroupCPU limit 500mContext
Memory cgroupMemory limit 128MiContext
Animation controls
Speed
0.5×
1×
2×
Explore a scenario
Normal behavior
No node fits
Filter by requests

Node A has only 100m of its scheduling budget left; low observed CPU usage cannot make the 200m request fit.

Inspect this state in YAML / kubectl
kubectl describe pod resource-demo
Read the complete visual sequence
  1. Filter by requests

    Node A has only 100m of its scheduling budget left; low observed CPU usage cannot make the 200m request fit.

  2. Bind to Node B

    Node B has 500m unrequested, so this resource check passes and the scheduler may bind the Pod there.

  3. Throttle CPU demand

    A bound container may burst above its request. Sustained demand beyond its CPU limit can be throttled by the runtime boundary.

  4. Memory allocation fails

    A memory limit is a separate boundary. An allocation that cannot be satisfied within the cgroup may trigger an OOM kill.

No node fits

Both suitable nodes have less than 200m unrequested CPU.

  1. Budget exhausted

    Existing admitted requests consume the placement budget on both nodes.

  2. Pending is expected

    The scheduler does not launch a container on an unsuitable node, so no runtime CPU limit can repair this placement failure.

  3. Repair the right boundary

    Add suitable capacity or deliberately revise requests; changing only a limit does not make the 200m request fit.

About this model

Single ordinary container on Linux; reservations and init-container accounting are omitted.

Try the mechanism with your own inputs
Bind to worker-aFits requested resources and constraints. This model picks the first feasible example node; Kubernetes also scores feasible nodes before binding. Available CPU means allocatable capacity minus requests, not current usage. The GPU label constrains placement only; it does not allocate a GPU device.. Requested Pod, 1 CPU, active. worker-a, 2 CPU unreserved · no GPU, ready. worker-b, 1 CPU unreserved · GPU label, idleRequested Pod: 1 CPU
Requested Pod1 CPUIn focus
worker-a: 2 CPU unreserved · no GPU
worker-a2 CPU unreserved · no GPUReady
worker-b: 1 CPU unreserved · GPU label
worker-b1 CPU unreserved · GPU labelContext
Requested Pod1 CPUIn focus
worker-a2 CPU unreserved · no GPUReady
worker-b1 CPU unreserved · GPU labelContext
Bind to worker-a

Fits requested resources and constraints. This model picks the first feasible example node; Kubernetes also scores feasible nodes before binding. Available CPU means allocatable capacity minus requests, not current usage. The GPU label constrains placement only; it does not allocate a GPU device.

# Pod spec fragment; example nodes carry accelerator labels.
spec:
  containers:
    - name: web
      image: nginx:1.28.0-alpine
      resources:
        requests:
          cpu: "1"
        limits:
          cpu: "4"
# The limit stays fixed; GPU allocation needs a device resource, not just a label.

Walkthrough: the same request has two different runtime outcomes

This complete Pod uses one small container. The image is a training convenience; use an approved immutable image identifier for a reproducible release. Apply it in the disposable namespace created by the module lab.

apiVersion: v1
kind: Pod
metadata:
  name: resource-demo
spec:
  containers:
    - name: web
      image: nginx:1.27-alpine
      resources:
        requests:
          cpu: 100m       # Scheduling accounts for 0.1 CPU.
          memory: 64Mi     # A reservation input, not measured usage.
        limits:
          cpu: 500m       # Runtime may throttle sustained CPU demand.
          memory: 128Mi   # Exceeding available limit can trigger OOM.

A CPU limit normally causes throttling when the container exhausts its allowed CPU time over an accounting period. Work slows down; the process is not normally killed merely for requesting additional CPU time. A memory limit cannot make memory reclaimable when an application keeps using it. The kernel may kill a process when the cgroup cannot satisfy an allocation within its memory constraints. A terminated container can report OOMKilled; inspect termination reason and events before assuming every exit code 137 is the same failure. A restarting process may recreate caches and repeat the failure indefinitely.

Quality of Service, or QoS, groups Pods according to resource configuration. In the standard container resource model, Guaranteed requires CPU and memory requests and limits for every container, with each request equal to its corresponding limit. BestEffort has none of those requests or limits. Burstable includes configurations between those extremes. The example is Burstable. Its class is a classification of configuration, not a measured promise of latency or immunity from failure.

Classify configuration before diagnosing pressure

Compare Guaranteed, Burstable and BestEffort configuration and their relationship to node pressure.

Policy viewStep 1 of 4
Guaranteed is configurationBoth resource pairs must be present and equal for every container in this simplified configuration.. Guaranteed Pod, Every CPU/memory request equals its limit, ready. Burstable Pod, CPU/memory request or limit set; Guaranteed rule fails, idle. BestEffort Pod, No CPU/memory requests or limits, idle. Node pressure, Priority and usage relative to requests matter, idle. Own memory limit, Can still kill a Guaranteed container, idleGuaranteed Pod: Every CPU/memory request equals its limit
Guaranteed PodEvery CPU/memory request equals its limitReady
Burstable Pod: CPU/memory request or limit set; Guaranteed rule fails
Burstable PodCPU/memory request or limit set; Guaranteed rule failsContext
BestEffort Pod: No CPU/memory requests or limits
BestEffort PodNo CPU/memory requests or limitsContext
Node pressure: Priority and usage relative to requests matter
Node pressurePriority and usage relative to requests matterContext
Own memory limit: Can still kill a Guaranteed container
Own memory limitCan still kill a Guaranteed containerContext
Guaranteed PodEvery CPU/memory request equals its limitReady
Burstable PodCPU/memory request or limit set; Guaranteed rule failsContext
BestEffort PodNo CPU/memory requests or limitsContext
Node pressurePriority and usage relative to requests matterContext
Own memory limitCan still kill a Guaranteed containerContext
Animation controls
Speed
0.5×
1×
2×
Explore a scenario
Normal behavior
Guaranteed still OOMs
Guaranteed is configuration

Both resource pairs must be present and equal for every container in this simplified configuration.

Inspect this state in YAML / kubectl
requests: {cpu: 250m, memory: 128Mi}
limits: {cpu: 250m, memory: 128Mi}
Read the complete visual sequence
  1. Guaranteed is configuration

    Both resource pairs must be present and equal for every container in this simplified configuration.

  2. Burstable can use spare CPU

    Different request and limit values make this example Burstable; it can consume spare CPU within its runtime boundary.

  3. BestEffort has no resource floor

    A Pod without these requests and limits is BestEffort. It has no such scheduler reservation and can be vulnerable under pressure.

  4. Pressure is more than class

    Eviction evaluates pressure signals, priority and usage relative to requests. A class is useful context rather than immunity.

Guaranteed still OOMs

A Guaranteed container exceeds its own memory limit.

  1. Reservation admitted

    Matching request and limit values classify the Pod as Guaranteed.

  2. Own limit reached

    The memory limit still applies to this container; QoS does not enlarge it.

  3. Inspect termination

    An OOMKilled last state and restart count explain runtime failure without changing the QoS classification.

About this model

Uses ordinary per-container CPU and memory fields; QoS is not a complete eviction algorithm.

Practice: observe the admitted object and its boundary

kubectl apply -f resource-demo.yaml
kubectl get pod resource-demo -o jsonpath='{.status.qosClass}{"\n"}'
kubectl describe pod resource-demo
kubectl get nodes -o custom-columns=NAME:.metadata.name,CPU:.status.allocatable.cpu,MEMORY:.status.allocatable.memory
# Requires the separately installed resource metrics pipeline.
kubectl top pod resource-demo

Expect the class to be Burstable, assuming admission has not changed the Pod. kubectl top may fail on a local cluster without Metrics Server; the API object and scheduling events remain useful without that add-on. Compare requested resources to measured consumption without treating either as a substitute for the other. The node description’s allocated resources section summarizes requests from assigned Pods, which is closer to scheduler capacity accounting than a single usage sample.

In a disposable namespace, change both resource pairs to equal values in a new Pod manifest and compare its class. Do not expect editing immutable Pod fields in place to perform a replacement automatically. Create a different named Pod or use a Deployment when practicing configuration changes. Remove the examples after recording their admitted settings and observed status.

Pitfalls: QoS is part of a larger pressure story

Node-pressure eviction considers the scarce resource, whether usage exceeds requests, Pod priority, and usage relative to requests. “BestEffort first, Guaranteed never” is an unsafe universal rule. A Guaranteed Pod can still fail from its own memory limit, infrastructure loss, or severe pressure. A high memory request also reduces placement options, so increasing it without measuring a working set may trade restarts for Pending Pods. CPU requests influence relative CPU allocation under contention; they do not buy a dedicated physical processor by themselves.

Check your understanding

A node has 2 allocatable CPUs, 1.9 CPUs already requested, and only 5 percent actual usage. Can a new 200m request fit?

No. The remaining scheduling budget is 100m, so this node fails the CPU request check even though current usage is low. Lowering the new Pod’s CPU limit would not change that request calculation. Investigate overestimated requests or add appropriate capacity, then evaluate runtime behavior under load before settling on new requests.

The placement and resources lab demonstrates a deliberately impossible node selector and reports the admitted QoS class. Resource exhaustion and runtime throttling are separate extensions using the examples in this lesson. Next, add a placement constraint and predict why a Pod that fits numerically can still remain Pending.

Primary documentation

Go to the source

Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise

Search the book

Search loads when you open it.