https://drive.google.com/file/d/171ZpDsWSlwVy02I4-5Z6Q7dCfaIKxqRw/view?usp=sharing

๐Ÿ” YAML Breakdown

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.


๐Ÿ“Œ What Is "Guaranteed" QoS?

A Pod gets Guaranteed QoS if and only if:

๐Ÿ’ก 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).


๐Ÿ†š Full QoS Comparison

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.


๐Ÿงช Lab: Deploy Guaranteed Pod & Verify QoS

๐Ÿ”ง Steps

# 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