https://drive.google.com/file/d/171ZpDsWSlwVy02I4-5Z6Q7dCfaIKxqRw/view?usp=sharing
apiVersion: v1
kind: Pod
metadata:
name: nnappone
namespace: learning
labels:
app: nnappone
spec:
containers:
- name: crackone-app
image: nginx
resources:
requests:
memory: "250Mi"
cpu: "400m"
limits:
memory: "250Mi" # โ Same as requests!
cpu: "400m" # โ Same as requests!
โ Key Observation:
For every container and every resource (CPU + memory):
requests == limits
๐ฏ This is the ONLY requirement for Guaranteed QoS.
A Pod gets Guaranteed QoS if and only if:
requests and limits for CPU and memory, ANDrequests == limits๐ก Why "Guaranteed"?
Kubernetes reserves exactly 400m CPU + 250Mi memory on a node before scheduling.
The Pod will never be starved of these resources (as long as the node is healthy).
| QoS Class | CPU req == lim? |
Memory req == lim? |
Eviction Priority | Use Case |
|---|---|---|---|---|
| BestEffort | โ Not defined | โ Not defined | ๐ด First | Debug pods, labs |
| Burstable | โ (or missing) | โ (or missing) | ๐ก Medium | Web apps, APIs |
| Guaranteed | โ Yes | โ Yes | ๐ข Last | Databases, monitoring, critical services |
๐ก๏ธ Guaranteed Pods are NEVER evicted due to resource pressure โ unless the node itself fails.
# 1. Create namespace
kubectl create namespace learning
# 2. Apply the Pod
kubectl apply -f pod-simple-qos-guaranteed.yml
# 3. Check Pod status
kubectl get pods -n learning
# 4. Describe Pod โ verify resources and QoS
kubectl describe pod nnappone -n learning | grep -A 5 -B 2 "QoS\\\\|Limits\\\\|Requests"
# โ
Expected output:
# Requests:
# cpu: 400m
# memory: 250Mi
# Limits:
# cpu: 400m
# memory: 250Mi
# QoS Class: Guaranteed
# 5. (Optional) Confirm via JSONPath
kubectl get pod nnappone -n learning -o jsonpath='{.status.qosClass}{"\\\\n"}'
# Output: Guaranteed
# 6. Clean up
kubectl delete pod nnappone -n learning
kubectl delete namespace learning