Resource Requests & Limits (CPU millicores, Memory Mi/Gi, QoS Classes)
Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS.
In plain words
Resource requests are a restaurant reservation and limits are the maximum party size; QoS tells the manager who is evicted if the room fills. The simple Kubernetes rule is: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Think of it like…
Resource requests are a restaurant reservation and limits are the maximum party size; QoS tells the manager who is evicted if the room fills.
Where you’ve seen it
A cluster operator validates a small change and runs kubectl describe node worker-1; kubectl top pod -n prod. Expected evidence: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape. If the run instead shows this symptom, stop and restore the last known state: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
Words you’ll hear
- Requests
- For this lesson, Requests is the controlling idea: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Limits
- Limits is the checkpoint; run
kubectl describe node worker-1; kubectl top pod -n prodand inspect the owner chain. Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority. - QoS
- QoS is the outcome to preserve; the cost is explicit: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
- Verification evidence
- The evidence command is
kubectl describe node worker-1; kubectl top pod -n prod. It connects the declaration to this behavior: Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS.
Visual diagram
Theory & deep dive
How Requests reaches the intended state
Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS. A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
The concrete checkpoint is kubectl describe node worker-1; kubectl top pod -n prod; compare the Requests owner, Limits state, and QoS outcome instead of treating YAML acceptance as proof.
Run kubectl describe node worker-1; kubectl top pod -n prod after the change and correlate the result with Events and the owning object. A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Limits: failure boundary and production cost
Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority. The prerequisite contract is concrete: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors. A safe design limits blast radius, records the last good configuration, and uses kubectl describe node worker-1; kubectl top pod -n prod as a deterministic rollback checkpoint.
Capture the current state with kubectl describe node worker-1; kubectl top pod -n prod, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
How it works, step by step
Step 1 of 41. Model the cluster contract
Start from a minimal API, context, or node condition and make this contract explicit: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Goal
- Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS.
- Owner
- Requests
When to use it & trade-offs
What it is
Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS. A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Why it matters: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority. The invariant at risk is specific: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape. The quickest fact check before changing the design is kubectl describe node worker-1; kubectl top pod -n prod.
When to reach for it
- Use Requests to enforce this invariant: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Use Limits evidence from
kubectl describe node worker-1; kubectl top pod -n prodin reviews and incident timelines. Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS. - Choose the platform-level abstraction route only when this cost is justified by governance or scale: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
When to avoid or be careful
- Avoid assuming Requests is complete after YAML submission; the required behavior is concrete: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Avoid treating the next symptom as random; check the owner and state with
kubectl describe node worker-1; kubectl top pod -n prodfirst: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority. - Avoid adopting a heavier platform wrapper before measuring its cost: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
Native, manual, and managed paths for Requests
kubectl describe node worker-1; kubectl top pod -n prod.Strengths: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Watch out: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors. Recovery must also recognize this signal: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
kubectl describe node worker-1; kubectl top pod -n prod; the expected invariant is: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.Strengths: kubectl describe node worker-1; kubectl top pod -n prod gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike Requests, it does not make this symptom self-documenting: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
kubectl describe node worker-1; kubectl top pod -n prod.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
Watch out: The added platform ownership buys value at this cost: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Trace Requests to QoS through Limits; the invariant is: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Recognize the symptom: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
- Justify the cost: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
- Verify with kubectl describe node worker-1; kubectl top pod -n prod instead of only inspecting YAML.
Benchmarks & rules of thumb
- 1000m
- CPU equals one virtual CPU core
- 1Gi
- is 1024 Mi rather than decimal GB
- 3
- QoS classes: Guaranteed, Burstable, and BestEffort
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the Requests owner contract: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape.
- Ignoring this telltale condition leads to unrelated changes: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority.
- Repeating
kubectl describe node worker-1; kubectl top pod -n prodwithout an owner for remediation wastes retry cost. Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape?
- Which owner object, logs, and Events would you inspect for this symptom-Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority-?
- At what threshold would this cost become unacceptable: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors?
kubectl describe node worker-1; kubectl top pod -n prod, name the failure, then justify the cost. Invariant: A CPU or memory request influences scheduling, a limit caps usage, and Kubernetes derives Guaranteed, Burstable, or BestEffort QoS from the resulting request/limit shape. Failure: Memory above a limit is OOMKilled, CPU throttling hides behind a high limit, and an unrequested workload receives BestEffort eviction priority. Cost: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Resource Requests & Limits (CPU millicores, Memory Mi/Gi, QoS Classes) with generative AI interview Q&A and hands-on practice.