By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
A hyper-practical, zero-fluff guide for engineers who need to deploy stable, cost-efficient workloads in production.
You’re running a Kubernetes cluster in production. One night, a misconfigured pod starts consuming all available CPU on a node, starving other critical services. Your monitoring alerts fire, but by the time you SSH in, the node is unresponsive. You force-drain it, but the outage has already cost thousands in lost transactions.
This is what happens when you ignore resource requests, limits, and QoS classes.
In Kubernetes, requests and limits define how much CPU and memory a container needs and can use, respectively. QoS classes (Guaranteed, Burstable, BestEffort) determine how Kubernetes prioritizes pods when resources run low. Together, they: - Prevent noisy neighbors from crashing your cluster.- Ensure critical workloads get the resources they need.- Help Kubernetes make smart scheduling decisions.- Optimize cloud costs by right-sizing pods.
Real-world scenario:You’re migrating a monolithic app to Kubernetes. The app has: - A high-priority API (must always have CPU/memory).- A batch job (can run when resources are available).- A low-priority logging sidecar (can be killed if needed).
Without proper resource management, the batch job could starve the API, or the logging sidecar could get evicted unnecessarily. This guide shows you how to configure these settings correctly.
Pending
requests: { cpu: "500m", memory: "256Mi" }
limits: { cpu: "1", memory: "512Mi" }
1
500m
1Gi
1G
kubectl
kubectl apply -f - <<EOF apiVersion: v1 kind: Pod metadata: name: nginx-besteffort spec: containers: - name: nginx image: nginx:latest EOF
Verify:
kubectl get pod nginx-besteffort -o json | jq '.status.qosClass' # Output: "BestEffort"
kubectl apply -f - <<EOF apiVersion: v1 kind: Pod metadata: name: nginx-burstable spec: containers: - name: nginx image: nginx:latest resources: requests: cpu: "100m" memory: "128Mi" EOF
kubectl get pod nginx-burstable -o json | jq '.status.qosClass' # Output: "Burstable"
kubectl apply -f - <<EOF apiVersion: v1 kind: Pod metadata: name: nginx-guaranteed spec: containers: - name: nginx image: nginx:latest resources: requests: cpu: "500m" memory: "256Mi" limits: cpu: "500m" memory: "256Mi" EOF
kubectl get pod nginx-guaranteed -o json | jq '.status.qosClass' # Output: "Guaranteed"
bash kubectl top node
bash kubectl get pods kubectl describe pod memory-hog | grep -i "oomkilled"
memory-hog
nginx-guaranteed
limits: 8Gi
yaml metadata: labels: qos: guaranteed
yaml apiVersion: v1 kind: ResourceQuota metadata: name: mem-cpu-quota spec: hard: requests.cpu: "10" requests.memory: 20Gi limits.cpu: "20" limits.memory: 40Gi
kubectl get events --sort-by='.metadata.creationTimestamp'
OOMKilled
Invalid value: must be less than or equal to cpu limit
requests <= limits
kubectl describe node
Allocatable
Gi
Mi
"A pod has requests: { cpu: 500m, memory: 1Gi } and limits: { cpu: 1, memory: 2Gi }. What is its QoS class?"
requests: { cpu: 500m, memory: 1Gi }
limits: { cpu: 1, memory: 2Gi }
Eviction Order:
"Under memory pressure, which pod is killed first: Guaranteed, Burstable, or BestEffort?"
CPU Throttling vs. Memory OOM:
"A pod exceeds its memory limit. What happens?"
Scheduling Failures:
requests == limits
requests < limits
Deploy a pod with: - Requests: cpu: 200m, memory: 256Mi.- Limits: cpu: 500m, memory: 512Mi.Verify its QoS class is Burstable.
cpu: 200m
memory: 256Mi
cpu: 500m
memory: 512Mi
Burstable
kubectl apply -f - <<EOF apiVersion: v1 kind: Pod metadata: name: challenge-pod spec: containers: - name: nginx image: nginx:latest resources: requests: cpu: "200m" memory: "256Mi" limits: cpu: "500m" memory: "512Mi" EOF
kubectl get pod challenge-pod -o json | jq '.status.qosClass' # Output: "Burstable"
Why it works: The pod has requests < limits, so Kubernetes assigns it the Burstable QoS class.
kubectl top pod
kubectl describe node <node>
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.