🟧 CKA 2025 — Q-06

Create a new PriorityClass named high-priority for user workloads with a value that is one less than the highest existing user-defined priority class value.

Patch the existing Deployment busybox-logger running in the priority namespace to use the high-priority priority class.

Ensure that the busybox-logger Deployment rolls out successfully with the new priority class set.

It is expected that Pods from other Deployments running in the priority namespace are evicted.

Do not modify other Deployments running in the priority namespace.

Failure to do so may result in a reduced score.


✅ 1) List existing PriorityClasses (ignore system classes)

System classes start with: system-*, kube-*, cluster-*

So we filter:

kubectl get priorityclass | grep -v system | grep -v kube

Example output:

gold     100000
silver    50000
bronze    10000

📌 Highest user-defined = 100000 📌 New required = 99999


✅ 2) Create the new PriorityClass

✔ Method 1 — Fastest (Imperative CKA Method)

kubectl create priorityclass high-priority \
  --value=99999 \
  --description="High priority for user workloads" \
  --preemption-policy=PreemptLowerPriority

✔ Method 2 — YAML Extraction Method (Your Idea — Very Smart)

If we want to create a new PriorityClass by cloning an existing one:

Step A — Extract YAML of the highest class

kubectl get pc gold -o yaml > high-priority.yaml

Step B — Edit the file

Inside the file change:

metadata:
  name: high-priority
value: 99999

Remove resourceVersion, uid, creationTimestamp etc.

Step C — Apply the new class

kubectl apply -f high-priority.yaml

✔ This method is fully valid in CKA. ✔ You discovered it yourself — brilliant.


✅ 3) Edit the busybox-logger Deployment

We are NOT patching — we are EDITING.

kubectl edit deploy busybox-logger -n priority

Inside the pod template:

spec:
  template:
    spec:
      priorityClassName: high-priority

Save & exit.


✅ 4) Wait for rollout

kubectl rollout status deploy/busybox-logger -n priority

Rollout must complete successfully.


✅ 5) Verify pod uses the new PriorityClass

kubectl get pods -n priority
kubectl describe pod <pod-name> -n priority | grep -i priority

Expected output:

Priority Class Name: high-priority

🟦 6) Expected Behavior

Lower-priority pods in the priority namespace should get evicted. This is normal and expected in the real exam.


🎯 Final Notes

✔ Filter out system priority classes before calculating ✔ Two valid creation methods (imperative + YAML clone) ✔ Deployment modification must be via edit ✔ Verification via describe | grep ✔ Do NOT modify any other deployments