Mastering All 17 Hands-On CLI Tasks in the 120-Minute Kubernetes CKA Exam
Accelerating kubectl manifest generation, recovering crashed Control Plane nodes, ETCD snapshots, and kubeadm cluster upgrades.
Hoang Bao Le
Senior DevOps & Platform Engineer • CKA • CKS • CKAD
Unlike multiple-choice exams, the CKA drops you into a live Linux terminal across 6 clusters to fix broken kubelets, restore ETCD, and author NetworkPolicies.
● KEY TAKEAWAYS & EXAM BLUEPRINT SUMMARY
- 01Always run the cluster context switch command (kubectl config use-context ...) provided at the top of every task—forgetting this costs 100% of that question's points.
- 02Never write YAML manifests from scratch: use --dry-run=client -o yaml > file.yaml to generate valid boilerplate in 3 seconds.
- 03Drill the 4 guaranteed tasks: ETCD Snapshot Backup/Restore, kubeadm minor version upgrade, RBAC/NetworkPolicy authoring, and Control Plane / kubelet recovery.
- 04Enforce a strict '7-Minute Rule': If a troubleshooting task takes longer than 7 minutes, flag it and secure high-weight tasks (7%–8%) first.
1. Terminal Environment Setup & High-Speed Imperative CLI Commands
The CNCF Certified Kubernetes Administrator (CKA) exam gives you 120 minutes to solve 15–17 live performance tasks across 6 Kubernetes clusters (passing score: 66/100). While you are allowed one browser tab open to kubernetes.io/docs, copying and editing long YAML templates from documentation will drain your clock unless you rely on imperative kubectl generators.
# 1. Define shorthand environment variables:
export do="--dry-run=client -o yaml"
export now="--force --grace-period=0"
# 2. Generate Pod, Deployment, and Service YAML without opening docs:
kubectl run web-pod --image=nginx:1.25-alpine --port=80 $do > pod.yaml
kubectl create deploy api-server --image=registry.k8s.io/pause:3.9 --replicas=3 $do > deploy.yaml
kubectl expose pod web-pod --name=web-svc --port=80 --target-port=80 --type=NodePort $do > svc.yaml
# 3. Create RBAC Role & RoleBinding in seconds:
kubectl create role pod-reader --verb=get,list,watch --resource=pods -n dev
kubectl create rolebinding dev-read-binding --role=pod-reader --serviceaccount=dev:app-sa -n dev2. Foolproof Playbook for ETCD Backup & Restore
Backing up and restoring the ETCD key-value store appears on virtually every CKA exam. The two most common mistakes are omitting one of the three TLS certificate flags (--cacert, --cert, --key) or forgetting to update the hostPath directory inside /etc/kubernetes/manifests/etcd.yaml after restoring.
# Step 1: Inspect certificate paths from the etcd Static Pod manifest
sudo cat /etc/kubernetes/manifests/etcd.yaml | grep -E 'listen-client|file'
# Step 2: Save the ETCD snapshot
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /opt/snapshot-pre-boot.db
# Step 3: Restore the snapshot into a fresh host directory
ETCDCTL_API=3 etcdctl snapshot restore /var/lib/backup/etcd-snapshot.db \
--data-dir=/var/lib/etcd-from-backup
# Step 4: Update volumes.hostPath.path in /etc/kubernetes/manifests/etcd.yaml
# to point to /var/lib/etcd-from-backup — kubelet will automatically recreate the etcd pod!3. Troubleshooting Triage Playbook (30% of Total Exam Score)
Troubleshooting accounts for 30% of the CKA blueprint. Whenever a cluster or workload fails, triage bottom-up: check Node health first, then Control Plane Static Pods, then Pod scheduling events, and finally Service Endpoints and NetworkPolicies.
| Symptom | Most Common Root Cause | Diagnostic & Recovery Commands |
|---|---|---|
| Worker Node stuck in NotReady status | kubelet systemd service is stopped or disabled on that worker node | ssh `<node>` → sudo systemctl status kubelet → sudo systemctl enable --now kubelet |
| kubectl fails: Connection to server :6443 was refused | Typo or invalid flag in /etc/kubernetes/manifests/kube-apiserver.yaml | sudo crictl ps -a → sudo crictl logs `<container-id>` → fix flag/port in the manifest YAML |
| Pod stuck in Pending state indefinitely | Untolerated Node Taint, insufficient CPU/Memory, or invalid schedulerName | kubectl describe pod `<name>` → inspect the Events table at the bottom |
| Service fails to route traffic to running Pods | Label selector mismatch between Service and Pod, or wrong targetPort | kubectl get ep `<service-name>` (Empty Endpoints means selector labels do not match the Pod) |
4. Kubeadm Cluster Minor Version Upgrade
Exact Sequence for Upgrading Control Plane & Worker Nodes
- •Step 1 — Drain the Node: Run
kubectl drain controlplane --ignore-daemonsetsbefore SSHing into the node. - •Step 2 — Upgrade the kubeadm package:
apt-mark unhold kubeadm && apt-get update && apt-get install -y kubeadm=1.30.0-* && apt-mark hold kubeadm. - •Step 3 — Apply the Control Plane upgrade:
sudo kubeadm upgrade plan && sudo kubeadm upgrade apply v1.30.0(Note: on Worker Nodes, runsudo kubeadm upgrade node). - •Step 4 — Upgrade kubelet & kubectl: Install matching versions of
kubeletandkubectl, runsudo systemctl daemon-reload && sudo systemctl restart kubelet, and finallykubectl uncordon.
Scenario Prompt:
Create a NetworkPolicy named allow-port-from-namespace in namespace prod that allows Pods in any namespace labeled project=frontend to connect to Pods labeled app=db in namespace prod on TCP port 5432 only.
✕ Common Distractor Trap
Using ipBlock or separating namespaceSelector and podSelector into two distinct list items with a leading hyphen (-).
✓ Recommended Architecture
Configure ingress.from with namespaceSelector: { matchLabels: { project: frontend } } and ports: [{ protocol: TCP, port: 5432 }].
✓ FINAL 5-MINUTE EXAM CHECKLIST

COMPANION MOBILE APP
LearnAWS by CertWorm
Turn these architecture blueprints into daily muscle memory with AI Study Coach roadmaps, timed 65-question mock exams, and choice-level rationales on iOS & Android.