Quality of Service Classes
What you'll learn: How Kubernetes automatically assigns Quality of Service (QoS) classes to Pods based on their CPU and memory resource specifications.
What Are QoS Classes?
Once you've set resource requests and limits on your containers, Kubernetes doesn't just store those values and forget them. Instead, it uses them to classify each Pod into one of three Quality of Service (QoS) classes: Guaranteed, Burstable, or BestEffort. This classification determines how Kubernetes treats your Pod during resource contention—specifically, which Pods get evicted first when a node runs out of memory.
Think of it like airline boarding groups: your ticket type (resource specs) determines your priority when things get crowded.
The Three QoS Classes
Guaranteed
Your Pod gets this highest-priority class when every container has:
- Both CPU and memory requests and limits set
- Requests equal to limits for both resources
# Guaranteed QoS
resources:
requests:
memory: "256Mi"
cpu: "500m"
limits:
memory: "256Mi" # Same as request
cpu: "500m" # Same as request
Burstable
Assigned when at least one container has a memory or CPU request set, but doesn't meet Guaranteed criteria. The Pod can "burst" beyond its request up to its limit.
# Burstable QoS
resources:
requests:
memory: "128Mi"
limits:
memory: "256Mi" # Different from request
BestEffort
The lowest priority—assigned when no containers specify any requests or limits. These Pods get whatever resources are left over.
Why It Matters
During memory pressure, Kubernetes evicts Pods in this order:
- BestEffort first
- Burstable next
- Guaranteed last
Key Takeaway: Kubernetes assigns QoS classes automatically based on your resource specs—Guaranteed (requests = limits) gets highest priority, Burstable (some limits set) is middle-tier, and BestEffort (no specs) faces eviction first during resource shortages.