Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 14/ 160
01. Kubernetes Fundamentals & Architecture

Resource Requests & Limits (CPU millicores, Memory Mi/Gi, QoS Classes)

Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS.

IntermediateRequests · Limits · QoS3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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 prod and 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

Loading interactive 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.

Verify Limits, not only object creation

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.

Key takeaway: Requests is implemented only when this invariant remains observable: 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.

Recover from Limits drift

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.

Key takeaway: Accept the trade-off consciously: Guaranteed QoS improves eviction behavior but can waste resources; requests below actual need increase contention while high limits permit noisy neighbors.

How it works, step by step

Step 1 of 4
Operator intent

1. 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.

Requests contract → owned state
Key numbers at this step
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 prod in 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 prod first: 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

Native cluster primitive
Best for: Set CPU/memory requests and limits and understand Guaranteed, Burstable, and BestEffort QoS. A concrete incident check is 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.

One-off administrative action
Best for: Quickly testing the Limits assumption with 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.

Platform-level abstraction
Best for: Teams that need QoS integrated with guardrails; the evidence path is 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 prod without 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?
Interview tip: Interview sequence: state the invariant, run 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

Loading quiz

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.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Viewing Logs, Executing Commands & Port-Forwarding (logs, exec, port-forward)
Next topic
Liveness, Readiness & Startup Probes