GUIDE #02CKACKAKUBERNETES • CLI PERFORMANCE LAB9 min read

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

Updated: Oct 14, 2026

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.

First-minute ~/.bashrc exports and imperative manifest 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 dev

2. 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-by-step ETCD Snapshot Save & Restore Playbook
# 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.

Rapid CKA Cluster & Workload Troubleshooting Matrix
SymptomMost Common Root CauseDiagnostic & Recovery Commands
Worker Node stuck in NotReady statuskubelet systemd service is stopped or disabled on that worker nodessh `<node>` → sudo systemctl status kubelet → sudo systemctl enable --now kubelet
kubectl fails: Connection to server :6443 was refusedTypo or invalid flag in /etc/kubernetes/manifests/kube-apiserver.yamlsudo crictl ps -a → sudo crictl logs `<container-id>` → fix flag/port in the manifest YAML
Pod stuck in Pending state indefinitelyUntolerated Node Taint, insufficient CPU/Memory, or invalid schedulerNamekubectl describe pod `<name>` → inspect the Events table at the bottom
Service fails to route traffic to running PodsLabel selector mismatch between Service and Pod, or wrong targetPortkubectl 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-daemonsets before 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, run sudo kubeadm upgrade node).
  • •Step 4 — Upgrade kubelet & kubectl: Install matching versions of kubelet and kubectl, run sudo systemctl daemon-reload && sudo systemctl restart kubelet, and finally kubectl uncordon.
SCENARIO WALKTHROUGH • NETWORK POLICY ISOLATION

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 }].

Core Architectural Rationale: In Kubernetes NetworkPolicy YAML, a new hyphen (-) in the ingress.from array creates a logical OR condition, whereas placing selectors inside the same list item creates a logical AND condition. Misplacing a single hyphen exposes pods to unintended traffic.

✓ FINAL 5-MINUTE EXAM CHECKLIST

Five minutes before your timer expires, iterate through each cluster and run kubectl get nodes and kubectl get pods -A to verify you never left a node cordoned after maintenance!
LearnAWS by CertWorm

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.

CONTINUE READING (9 MORE TECHNICAL GUIDES)

More Certification Study Guides

#01SAA-C03SAA-C03
10 min read

How to Pass AWS Solutions Architect Associate (SAA-C03) on Your First Attempt in 6 Weeks

The SAA-C03 exam packs 65 scenario-based questions into 130 minutes. Rather than skimming thousands of pages of docs, mastering service trade-offs accounts for 80% of your score.

Read guide
#03AZ-104AZ-104
8 min read

Azure (AZ-104) vs. AWS (SAA-C03) Service Mapping Guide for Multi-Cloud Engineers

If you already know AWS and are preparing for Azure Administrator (AZ-104), mapping equivalent architectural primitives cuts your study time in half.

Read guide
#04SM-2SM-2
7 min read

Using the SuperMemo-2 (SM-2) Algorithm to Retain 800+ Cloud Architecture Concepts

The Ebbinghaus Forgetting Curve proves that engineers lose over 60% of newly read technical limits within 24 hours without active spaced retrieval.

Read guide
#05SY0-701SY0-701
8 min read

5 Classic Networking & Security Exam Traps in CompTIA Security+ (SY0-701) & CCNA

Both CompTIA Security+ (SY0-701) and Cisco CCNA (200-301) heavily test scenario-based architecture and performance-based troubleshooting.

Read guide
#06GCP-PCAGCP-PCA
9 min read

Decoding All 4 Official Case Studies in the Google Cloud Architect (GCP-PCA) Exam

Nearly 30% of questions on the GCP-PCA exam directly reference 4 pre-published enterprise case studies. Mapping their service stacks beforehand is your biggest advantage.

Read guide
#07PMP®PMP®
8 min read

Solving All 180 Agile & Hybrid Situational Questions in the PMI PMP® Exam

On the PMP exam, all four options often sound reasonable, but only one follows the strict PMI Mindset sequence: Assess first, collaborate second, act third.

Read guide
#08CLF-C02CLF-C02
7 min read

AWS Cloud Practitioner (CLF-C02) Guide: Shared Responsibility, CAF & Support Plans

CLF-C02 is the ideal launchpad into cloud engineering. Mastering Security OF the Cloud vs. Security IN the Cloud locks in 30% of your total exam score.

Read guide
#09200-301200-301
9 min read

Mastering Longest Prefix Match Routing, Spanning Tree & VLAN Trunking for CCNA 200-301

Never let Administrative Distance trick you when two routes have different subnet mask lengths (/27 always beats /24 regardless of routing protocol).

Read guide
#10SAA-C03SAA-C03
9 min read

Anatomy of AWS IAM Policy Evaluation Logic, SCPs, Permissions Boundaries & Cross-Account Roles

A single Explicit Deny in any policy layer overrides every Allow statement. Let’s dissect the 5-step AWS IAM evaluation pipeline with real JSON policies.

Read guide