SkillByAIOpen interactive version →

Lesson 16 / 25

QoS Classes and Eviction

Who gets evicted first under pressure.

Guaranteed, Burstable, BestEffort

Kubernetes assigns each pod a Quality of Service class from its resources: Guaranteed (every container has requests equal to limits for CPU and memory), Burstable (some requests set), BestEffort (none set). When a node runs low on memory, the kubelet evicts pods, BestEffort first, then Burstable pods using the most above their requests. Critical workloads should be Guaranteed or at least have accurate requests; PriorityClasses further decide which pods may preempt others.

Resources for each QoS class

Not applied to a live cluster in this course; check field names against the API reference for your version.

# Guaranteed: requests == limits for cpu and memory in every container
resources: {requests: {cpu: "500m", memory: 512Mi}, limits: {cpu: "500m", memory: 512Mi}}

# Burstable: requests set, limits higher (or missing)
resources: {requests: {cpu: "250m", memory: 256Mi}, limits: {memory: 512Mi}}

# BestEffort: no requests or limits at all (first to be evicted)
resources: {}

Never run production pods as BestEffort

Pods without requests are the first to be evicted and can starve neighbours.

Quick check: Which pods are evicted first when a node runs out of memory?

  • The newest pods regardless of class
  • Guaranteed pods
  • BestEffort pods with no requests or limits
  • Pods with the longest names
Answer

BestEffort pods with no requests or limits — Set requests to protect important pods.