Timed task drills by domain
Complete common tasks (RBAC, etcd, NetworkPolicy, upgrade) in under 6 minutes each.
By Invicly Tech, , in Kubernetes Administrator (CKA). About 11 minutes to read.
In short
Drills turn common exam tasks into muscle memory. Repeat RBAC, etcd backup, NetworkPolicy and upgrade tasks against a timer until each takes under six minutes. Speed comes from knowing the command and the docs page, not from typing faster.
Explained simply
The CKA is a hands-on exam. You get a real terminal and real clusters, and about two hours to finish a list of tasks. There are no multiple-choice questions. A grader checks the final state of the cluster, so what counts is whether the thing works, not how you got there.
Most people who fail know enough Kubernetes. They run out of time. A task that takes 15 minutes because you are searching for a flag costs you two easier tasks later. That is why you drill: you repeat the same kinds of tasks against a timer until they feel automatic.
Four task types come up again and again and are worth drilling first: RBAC (who may do what), etcd backup and restore, NetworkPolicy (which pods may talk to which), and upgrading a cluster with kubeadm. Each has a fixed recipe you can learn by heart.
A good drill is short and honest. Start from a clean namespace or a fresh practice cluster, start a timer, solve the task without looking at your old answer, and finish with a command that proves it worked. Write down your time and the step that slowed you down.
Press Play on a diagram to walk through it one step at a time.
- 1Pick a task
RBAC, etcd, NetworkPolicy or upgrade.
- 2Start timer
Work from a fresh cluster or namespace.
- 3Solve and verify
Prove it with get, can-i or curl.
- 4Note slow steps
Which flag or doc page cost time?
- 5Repeat tomorrow
Until under six minutes, twice in a row.
- Back to step 1
- 1API objects
RBAC and NetworkPolicy: kubectl only
- 2Static pod manifests
etcd restore: edit files in /etc/kubernetes/manifests
- 3Node packages
Upgrade: apt, kubeadm, kubelet
- 4systemd
Restart kubelet after upgrades or config changes
In depth
RBAC drills: create, bind, prove
RBAC tasks almost always follow the same pattern: create a Role (or ClusterRole) with some verbs on some resources, bind it to a user, group or ServiceAccount, and prove it works. Imperative commands are much faster than writing YAML: kubectl create role, kubectl create rolebinding, and kubectl create clusterrolebinding all take --verb, --resource, --user, --group and --serviceaccount flags.
The proof is kubectl auth can-i. With --as you can impersonate a user, or a ServiceAccount using the full form system:serviceaccount:NAMESPACE:NAME. Always test one action that should be allowed and one that should be denied, in the right namespace.
Common slips: binding a Role from another namespace (a RoleBinding can only reference a Role in its own namespace, or a ClusterRole), using the plural pods in can-i but the wrong API group in the role, and forgetting -n.
- k create role r --verb=get,list,watch --resource=pods,deployments -n dev
- k create rolebinding rb --role=r --serviceaccount=dev:app -n dev
- k auth can-i list pods --as=system:serviceaccount:dev:app -n dev
- k auth can-i delete pods --as=system:serviceaccount:dev:app -n dev # no
etcd backup and restore
etcd holds the whole cluster state. On a kubeadm cluster it runs as a static pod on the control plane node, and its certificates are in /etc/kubernetes/pki/etcd. To take a snapshot, run etcdctl snapshot save with the endpoint https://127.0.0.1:2379 and three TLS flags: --cacert (ca.crt), --cert (server.crt) and --key (server.key). If you forget the paths, read them from /etc/kubernetes/manifests/etcd.yaml; the drill is partly about knowing where to look.
Restore with etcdutl snapshot restore into a new data directory, for example /var/lib/etcd-restore (older guides use etcdctl snapshot restore, which is deprecated). Then edit the etcd static pod manifest so its hostPath data volume points at the new directory. The kubelet notices the change and restarts etcd; the API server may be unavailable for a minute.
Verify the backup with etcdutl snapshot status FILE -w table, and verify the restore by checking that objects created after the backup are gone.
- 1Find cert paths
Read /etc/kubernetes/manifests/etcd.yaml
- 2Restore snapshot
etcdutl snapshot restore into a new data dir
- 3Edit manifest
hostPath for etcd-data points to the new dir
- 4Wait for restart
Kubelet recreates the etcd static pod
- 5Verify
k get pods -A works; newer objects are gone
NetworkPolicy drills
NetworkPolicies only take effect if the cluster's network plugin enforces them (Calico and Cilium do; plain flannel does not), and exam clusters are set up to enforce them. A policy selects pods with podSelector, and as soon as a pod is selected for a direction (Ingress or Egress), everything in that direction not explicitly allowed is blocked.
The tricky part is the from and to lists. Two selectors in the same list item (namespaceSelector and podSelector together) mean AND: pods with that label in namespaces with that label. Two separate list items mean OR. One misplaced dash changes the meaning completely.
When you restrict egress, remember DNS. Pods look up service names over UDP and TCP port 53, so an egress policy without a DNS rule breaks name resolution. Verify with a throwaway pod: kubectl run tmp --rm -it --image=busybox -- wget -qO- -T 2 http://svc.ns, once from an allowed pod and once from a blocked one.
- - namespaceSelector: team=web
- podSelector: app=front
- Only front pods in web namespaces
- Usually what the task wants
- - namespaceSelector: team=web
- - podSelector: app=front
- Any pod in web namespaces
- Or front pods in this namespace
Cluster upgrade with kubeadm
You can only upgrade one minor version at a time, for example 1.33 to 1.34, and the control plane goes first. Since 2023 packages come from pkgs.k8s.io, which has one repository per minor version, so the first step is often to change the version in /etc/apt/sources.list.d/kubernetes.list and run apt-get update.
On the control plane: unhold and install the new kubeadm, run kubeadm upgrade plan, then kubeadm upgrade apply v1.34.x. Drain the node with --ignore-daemonsets, upgrade kubelet and kubectl, run systemctl daemon-reload and systemctl restart kubelet, then uncordon. On each worker: upgrade kubeadm, run kubeadm upgrade node, drain from the control plane, upgrade kubelet and kubectl, restart kubelet, uncordon.
This is the longest drill, often 10 minutes at first. Most time is lost on package versions: apt-cache madison kubeadm lists the exact strings, such as 1.34.2-1.1.
- Hold packages again with apt-mark hold after installing
- Drain and uncordon run where kubectl works, usually the control plane
- Verify with k get nodes: VERSION shows the kubelet version
Learn it in 5 short steps
About 1h 10m each. Track them with a timer in your plan.
- 1Drill RBAC tasks~1h 10m
- 2Drill etcd backup and restore~1h 10m
- 3Drill NetworkPolicy tasks~1h 10m
- 4Drill a cluster upgrade~1h 10m
- 5Get each task under six minutes~1h 10m
Key points
- Bookmark the exact docs page for each drill topic.
- Always finish with a verification command; unverified work may be wrong.
- Reset the environment so you do not rely on leftover objects.
- Track times to see real progress.
Key terms
Tap a card to flip it. 0/3 known
Examples
Timed RBAC drill
Task: in namespace dev, ServiceAccount ci must be able to list and create deployments, and nothing else. Step 1: create the ServiceAccount. Step 2: create a Role with verbs list and create on deployments. Step 3: bind it. Step 4: prove one allowed and one denied action. Typical first try: 4 minutes; target under 2.
k create ns dev
k -n dev create sa ci
k -n dev create role deployer --verb=list,create --resource=deployments
k -n dev create rolebinding deployer --role=deployer --serviceaccount=dev:ci
k -n dev auth can-i create deployments --as=system:serviceaccount:dev:ci # yes
k -n dev auth can-i delete deployments --as=system:serviceaccount:dev:ci # no
k -n dev auth can-i list pods --as=system:serviceaccount:dev:ci # noTimed etcd backup drill
Task: save a snapshot of etcd to /opt/etcd-backup.db. Step 1: get the cert paths from the manifest with grep. Step 2: run etcdctl with the four connection flags. Step 3: check the file with etcdutl snapshot status. On the real exam the task text tells you which node to work on; if etcdctl is missing locally, the task will say where to run it.
grep -E 'cert-file|key-file|trusted-ca-file' /etc/kubernetes/manifests/etcd.yaml
ETCDCTL_API=3 etcdctl snapshot save /opt/etcd-backup.db \
--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
etcdutl snapshot status /opt/etcd-backup.db -w tableQuick reference
- k auth can-i VERB RESOURCE --as=system:serviceaccount:NS:NAME -n NS
- A RoleBinding can reference a Role in its own namespace or any ClusterRole
- etcd certs live in /etc/kubernetes/pki/etcd; read paths from manifests/etcd.yaml
- Restore with etcdutl snapshot restore --data-dir NEW, then point the manifest at NEW
- NetworkPolicy: selectors in one list item = AND, separate items = OR
- Egress policies must allow port 53 UDP and TCP or DNS breaks
- Upgrade one minor at a time: control plane first, then each worker
- apt-cache madison kubeadm shows the exact package versions
Common mistakes
- Drilling only easy tasks you already know.
- Copying old answers instead of typing them from memory.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Create a ClusterRole that can get and list nodes and bind it to user jane. Prove she can list nodes but not delete them. Target: under 2 minutes.
- Exercise 2medium
In namespace prod, allow ingress to pods labelled app=db on port 5432 only from pods labelled app=api in the same namespace, and deny all other ingress to the db pods. Target: under 5 minutes.
- Exercise 3hard
Upgrade the control plane node of a practice cluster by one minor version, including the package repository change. Time yourself and note the slowest step.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- How long is the CKA exam and what is the pass mark?
- Two hours of hands-on tasks, and the pass mark is 66%. Registration includes one free retake.
- Which Kubernetes version does the CKA use?
- The exam tracks a recent minor release and is updated a few weeks after each new version. Check the Linux Foundation's exam page for the current version before you practise.
- Do I need to memorise YAML?
- No. You can open the official docs during the exam and use kubectl create with --dry-run=client -o yaml to generate most manifests. Memorise where to find things and the imperative commands.
- Where can I practise these drills for free?
- A local kubeadm cluster on two virtual machines is the closest to the exam. Tools like kind or minikube work for RBAC and NetworkPolicy drills but not for kubeadm upgrades.