Kubernetes · Practice · 60-90 min
CKA Practice: 10 Broken-Cluster Drills on kind
Ten CKA-style Kubernetes drills on a free two-node kind cluster: a script breaks one thing, you fix it from the symptom, and a check proves the fix.
Ten broken-cluster drills for CKA practice, free and on your own machine: each one breaks a two-node kind cluster in one way, gives you a task, a hint and a check. Short solutions with real output come after the tasks, and the full explanation of each cause is linked. Every drill was run on kind v0.33.0 with Kubernetes v1.37.0.
On this page
If you are looking for CKA practice questions you can run on a laptop for free, this page has ten of them. Each drill is a small script that breaks a Kubernetes cluster in one specific way, a task written as a short instruction, a hint, and a check command that proves the fix. The fixes are short on purpose: the full explanation of each cause lives in a guide, and the drill links to it.
The drills are "CKA-style". They follow the public curriculum domains of the Certified Kubernetes Administrator exam (troubleshooting, workloads and scheduling, services and networking, storage, cluster architecture) and nothing else. This page says nothing about the real exam's environment, Kubernetes version, scoring or question wording, and no drill comes from a course or a question dump.
All ten were run on a two-node kind cluster: one control-plane node and one worker node, kind v0.33.0, Kubernetes v1.37.0, the default kindnet network plugin, containerd and the default standard storage class. Workload images are nginx:1.27-alpine and busybox:1.37. The only host commands are docker, kind and kubectl, so there is no distribution-specific variant to cover. Tested on 2026-11-15 with Docker 29.1.3 and kubectl v1.37.1.
0. Rules of engagement
- Use a throwaway cluster. Every drill creates its own namespace and breaks only that namespace, except drills 5 and 10, which touch the worker node itself. Drill 2's fix labels the worker node; its cleanup removes the label. Do not run any of this against a cluster that matters.
- All commands run as the cluster-admin that kind configures in your kubeconfig.
- Read each setup script before you run it. They are short, plain
kubectlcommands. - Drills 5 and 10 run alone. Drill 5 cordons the worker and drill 10 stops its kubelet, and with one worker nothing else can be scheduled meanwhile. Run each one, finish it, run its cleanup. The other eight can be set up at the same time; we did that on a fresh cluster and every drill showed its own broken state without disturbing the others.
- Try first, then read. Section 2 has the tasks and hints. Section 3 has the solutions with real output, so stop reading at the end of section 2 until you have tried.
- Time budgets are suggestions. Each drill carries a rough class of 2 or 5 minutes. That is a rough class we assigned after running each fix once. It is a suggested budget, not a measurement of how long you need.
1. Create the two-node cluster
You need Docker and kind, plus kubectl. The cluster config is the one we use for every Kubernetes test on this site:
# docs/kind-two-node.yaml: one control-plane node and one worker node
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: workerSave it as kind-two-node.yaml, then create the cluster and wait for both nodes:
# Create a cluster named cka with the two-node config, then wait for Ready
kind create cluster --name cka --config kind-two-node.yaml
kubectl wait --for=condition=Ready node --all --timeout=120s# Real output (excerpt; the kind progress lines are shortened)
Creating cluster "cka" ...
✓ Ensuring node image (kindest/node:v1.37.0) 🖼️
✓ Preparing nodes 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
Set kubectl context to "kind-cka"Right after creation both nodes can be NotReady for a moment; the kubectl wait line returns when they are ready. The nodes are named cka-control-plane and cka-worker, which drills 2, 5 and 10 use.
2. The ten drills
Each drill has a domain, a suggested time budget, a setup script, the task and a hint. The domain tag on each drill is our own classification. Run the setup, read the task, and fix it without looking at section 3.
Drill 1: the web Service refuses connections
- Domain: Troubleshooting. Suggested budget: 5 minutes.
- Full explanation: Fix a Kubernetes Service with no endpoints
# Setup for drill 1: namespace drill-01 with a Deployment, a Service and a client Pod
kubectl create namespace drill-01 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-01 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: web}
spec:
replicas: 2
selector: {matchLabels: {app: web}}
template:
metadata: {labels: {app: web}}
spec:
containers:
- {name: nginx, image: "nginx:1.27-alpine", ports: [{containerPort: 80}]}
---
apiVersion: v1
kind: Service
metadata: {name: web}
spec:
selector: {app: webapp}
ports: [{port: 80, targetPort: 80}]
---
apiVersion: v1
kind: Pod
metadata: {name: client}
spec:
containers: [{name: sh, image: "busybox:1.37", command: ["sleep", "3600"]}]
YAML
kubectl -n drill-01 rollout status deployment/web --timeout=120s
kubectl -n drill-01 wait --for=condition=Ready pod/client --timeout=120sTask: In namespace drill-01, the Service web has no backends and clients get "Connection refused". Make the Service reach the two web Pods without changing the Deployment.
Hint: Compare the selector shown by kubectl describe service web with the labels shown by kubectl get pods --show-labels.
Drill 2: the cache Pod never gets a node
- Domain: Troubleshooting. Suggested budget: 5 minutes.
- Full explanation: Troubleshoot a Kubernetes Pod stuck Pending
# Setup for drill 2: a Deployment whose Pod asks for a node label nobody has
kubectl create namespace drill-02 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-02 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: cache}
spec:
replicas: 1
selector: {matchLabels: {app: cache}}
template:
metadata: {labels: {app: cache}}
spec:
nodeSelector: {disktype: ssd}
containers:
- {name: nginx, image: "nginx:1.27-alpine"}
YAMLTask: In namespace drill-02, the Deployment cache has a Pod that stays Pending. It must run on the worker node. Do not change the Deployment.
Hint: The scheduler's reason is in the Events at the end of kubectl describe pod. Then look at what labels the nodes have.
Drill 3: the report Pod will not stay up
- Domain: Troubleshooting. Suggested budget: 5 minutes.
- Full explanation: Troubleshoot a Kubernetes Pod that keeps restarting is general triage for a restarting Pod. It treats a wrong ConfigMap key as CreateContainerConfigError; this drill is a missing file under a ConfigMap mount.
# Setup for drill 3: an app that reads a config file the ConfigMap does not contain
kubectl create namespace drill-03 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-03 -f - <<'YAML'
apiVersion: v1
kind: ConfigMap
metadata: {name: report-config}
data:
setting.conf: "mode=report"
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: report}
spec:
replicas: 1
selector: {matchLabels: {app: report}}
template:
metadata: {labels: {app: report}}
spec:
containers:
- name: app
image: busybox:1.37
command: ["sh", "-c", "cat /etc/report/settings.conf && echo loaded && sleep 3600"]
volumeMounts: [{name: cfg, mountPath: /etc/report}]
volumes:
- {name: cfg, configMap: {name: report-config}}
YAMLTask: In namespace drill-03, the Pod of Deployment report keeps restarting. The app reads /etc/report/settings.conf. Fix it without editing the Deployment.
Hint: Read the container log, then compare the file name in the log with the keys in the ConfigMap. The STATUS column alternates between Error and CrashLoopBackOff while the container is restarting, so do not wait for one particular word.
Drill 4: A rollout that never finishes
- Domain: Workloads and scheduling. Suggested budget: 2 minutes.
- Full explanation: Troubleshoot Kubernetes ImagePullBackOff (the diagnosis;
rollout undoitself is the fix here)
# Setup for drill 4: a healthy Deployment, then an update to an image tag that does not exist
kubectl create namespace drill-04 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-04 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: shop}
spec:
replicas: 2
selector: {matchLabels: {app: shop}}
template:
metadata: {labels: {app: shop}}
spec:
containers:
- {name: nginx, image: "nginx:1.27-alpine"}
YAML
kubectl -n drill-04 rollout status deployment/shop --timeout=120s
kubectl -n drill-04 set image deployment/shop nginx=nginx:1.27-alpine-releaseTask: In namespace drill-04, a rollout of Deployment shop never finishes. Restore the previous working version.
Hint: kubectl rollout history lists the revisions. The two old Pods are still serving.
Drill 5: A drain that does not finish
- Domain: Workloads and scheduling. Suggested budget: 5 minutes.
- Affects the whole worker node: run it alone and run its cleanup.
- Full explanation: none yet.
# Setup for drill 5: two replicas protected by a PodDisruptionBudget that allows no disruption
kubectl create namespace drill-05 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-05 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: queue}
spec:
replicas: 2
selector: {matchLabels: {app: queue}}
template:
metadata: {labels: {app: queue}}
spec:
containers:
- {name: nginx, image: "nginx:1.27-alpine"}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {name: queue-pdb}
spec:
minAvailable: 2
selector: {matchLabels: {app: queue}}
YAML
kubectl -n drill-05 rollout status deployment/queue --timeout=120sTask: Drain the worker node cka-worker for maintenance. The drain does not finish because of a budget in namespace drill-05. Make the drain finish, then uncordon the node.
Hint: Run the drain with --ignore-daemonsets --delete-emptydir-data --timeout=20s and read the refusal. Then kubectl -n drill-05 get pdb: look at ALLOWED DISRUPTIONS.
Drill 6: A NetworkPolicy blocks traffic
- Domain: Services and networking. Suggested budget: 5 minutes.
- Full explanation: none yet.
# Setup for drill 6: an api behind a deny-all ingress policy, a labeled client and an unlabeled Pod
kubectl create namespace drill-06 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-06 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: api}
spec:
replicas: 1
selector: {matchLabels: {app: api}}
template:
metadata: {labels: {app: api}}
spec:
containers:
- {name: nginx, image: "nginx:1.27-alpine", ports: [{containerPort: 80}]}
---
apiVersion: v1
kind: Service
metadata: {name: api}
spec:
selector: {app: api}
ports: [{port: 80, targetPort: 80}]
---
apiVersion: v1
kind: Pod
metadata: {name: client, labels: {role: client}}
spec:
containers: [{name: sh, image: "busybox:1.37", command: ["sleep", "3600"]}]
---
apiVersion: v1
kind: Pod
metadata: {name: other}
spec:
containers: [{name: sh, image: "busybox:1.37", command: ["sleep", "3600"]}]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: default-deny-ingress}
spec:
podSelector: {}
policyTypes: [Ingress]
YAML
kubectl -n drill-06 rollout status deployment/api --timeout=120s
kubectl -n drill-06 wait --for=condition=Ready pod/client pod/other --timeout=120sTask: In namespace drill-06, the Pod client cannot reach Service api. Allow only Pods labeled role=client to reach api on port 80. Do not delete the existing policy.
Hint: Policies add up: a second policy can allow what the first one denies. The policy selects the Pods it protects (api) and lists who may come in.
Drill 7: The DNS name of a Service in another namespace
- Domain: Services and networking. Suggested budget: 2 minutes.
- Full explanation: none yet.
# Setup for drill 7: a db Service in one namespace, a client Pod in another
kubectl create namespace drill-07 --dry-run=client -o yaml | kubectl apply -f -
kubectl create namespace drill-07-db --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-07-db -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: db}
spec:
replicas: 1
selector: {matchLabels: {app: db}}
template:
metadata: {labels: {app: db}}
spec:
containers:
- {name: nginx, image: "nginx:1.27-alpine", ports: [{containerPort: 80}]}
---
apiVersion: v1
kind: Service
metadata: {name: db}
spec:
selector: {app: db}
ports: [{port: 80, targetPort: 80}]
YAML
kubectl apply -n drill-07 -f - <<'YAML'
apiVersion: v1
kind: Pod
metadata: {name: client}
spec:
containers: [{name: sh, image: "busybox:1.37", command: ["sleep", "3600"]}]
YAML
kubectl -n drill-07-db rollout status deployment/db --timeout=120s
kubectl -n drill-07 wait --for=condition=Ready pod/client --timeout=120sTask: The Pod client in namespace drill-07 must reach Service db, which lives in namespace drill-07-db. Find the name that works from drill-07.
Hint: Look at the search line in /etc/resolv.conf inside the client Pod.
Drill 8: A PersistentVolumeClaim stuck Pending
- Domain: Storage. Suggested budget: 5 minutes.
- Full explanation: Troubleshoot a Kubernetes Pod stuck Pending (storage causes of Pending)
# Setup for drill 8: a claim that names a storage class the cluster does not have
kubectl create namespace drill-08 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-08 -f - <<'YAML'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: {name: data}
spec:
accessModes: [ReadWriteOnce]
storageClassName: fast
resources: {requests: {storage: 100Mi}}
---
apiVersion: v1
kind: Pod
metadata: {name: writer}
spec:
containers:
- name: sh
image: busybox:1.37
command: ["sh", "-c", "echo hello > /data/out.txt && sleep 3600"]
volumeMounts: [{name: d, mountPath: /data}]
volumes: [{name: d, persistentVolumeClaim: {claimName: data}}]
YAMLTask: In namespace drill-08, the Pod writer is Pending because its PersistentVolumeClaim is not bound. Fix it so the Pod runs and can write to /data.
Hint: kubectl describe pvc data shows the event, and kubectl get storageclass shows what exists. Applying a changed storageClassName over the existing claim is refused.
Drill 9: A ServiceAccount gets Forbidden
- Domain: Cluster architecture (RBAC). Suggested budget: 5 minutes.
- Full explanation: none live yet.
# Setup for drill 9: a ServiceAccount, a Role, a RoleBinding with a mistake, and a Pod with a log line
kubectl create namespace drill-09 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-09 -f - <<'YAML'
apiVersion: v1
kind: ServiceAccount
metadata: {name: reporter}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: {name: pod-reader}
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: {name: pod-reader}
roleRef: {apiGroup: rbac.authorization.k8s.io, kind: Role, name: pod-reader}
subjects:
- {kind: ServiceAccount, name: reports, namespace: drill-09}
---
apiVersion: v1
kind: Pod
metadata: {name: sample}
spec:
containers: [{name: sh, image: "busybox:1.37", command: ["sh", "-c", "echo sample log line; sleep 3600"]}]
YAML
kubectl -n drill-09 wait --for=condition=Ready pod/sample --timeout=120sTask: In namespace drill-09, the ServiceAccount reporter must be able to list Pods and read Pod logs in that namespace only. Today it gets Forbidden. Do not grant anything else.
Hint: Test as the ServiceAccount with --as=system:serviceaccount:drill-09:reporter, using kubectl auth can-i. There is more than one defect: check the subject of the binding and the resources in the Role.
Drill 10: A worker node that is NotReady
- Domain: Troubleshooting. Suggested budget: 5 minutes.
- Affects the whole worker node: run it alone and run its cleanup.
- Full explanation: none yet.
# Setup for drill 10: pin a Pod to the worker, then stop the kubelet inside the worker container
kubectl create namespace drill-10 --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n drill-10 -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata: {name: pinned}
spec:
replicas: 1
selector: {matchLabels: {app: pinned}}
template:
metadata: {labels: {app: pinned}}
spec:
nodeSelector: {kubernetes.io/hostname: cka-worker}
containers:
- {name: nginx, image: "nginx:1.27-alpine"}
YAML
kubectl -n drill-10 rollout status deployment/pinned --timeout=120s
docker exec cka-worker systemctl stop kubelet
for i in $(seq 1 30); do
s=$(kubectl get node cka-worker --no-headers | awk '{print $2}')
[ "$s" = NotReady ] && break
sleep 5
done
echo "worker status: $s"Task: Node cka-worker is NotReady. Bring it back to Ready. On kind the node is a Docker container, so you reach it with docker exec; on a real cluster you would use an SSH session to the node.
Hint: The node's Ready condition message says who stopped talking. Then check the service that reports node status, on the node itself.
3. Solutions and checks
Each solution shows the evidence, the narrow fix, the check with real output and the cleanup. All output is real, from the cluster described at the top.
Drill 1: solution
# Compare labels with the selector, then correct the Service selector
kubectl -n drill-01 get pods --show-labels
kubectl -n drill-01 patch service web -p '{"spec":{"selector":{"app":"web"}}}'The Service selected app=webapp while the Pods carry app=web, so the EndpointSlice was empty. Check:
# Check: the EndpointSlice has addresses and the client gets an answer
kubectl -n drill-01 get endpointslices -l kubernetes.io/service-name=web
kubectl -n drill-01 exec client -- wget -S -qO /dev/null -T 3 http://web# Real output (excerpt; the wget headers are cut after the status line)
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
web-4ctvd IPv4 80 10.244.1.22,10.244.1.21 2s
HTTP/1.1 200 OKBefore the fix, the EndpointSlice showed <unset> endpoints and wget said Connection refused. Cleanup:
# Cleanup for drill 1
kubectl delete namespace drill-01 --wait=trueDrill 2: solution
# Label the worker so the Pod's nodeSelector matches; the Deployment stays as it is
kubectl label node cka-worker disktype=ssd
kubectl -n drill-02 rollout status deployment/cache --timeout=120sThe Pending Pod's event counted both nodes: the control-plane was rejected by its taint and the worker by the selector.
# Real output (the event before the fix, shortened)
Warning FailedScheduling 5s default-scheduler 0/2 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint(s). ...# Check: the Pod is Running on the worker
kubectl -n drill-02 get pods -o wide# Real output
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
cache-64fb469448-47592 1/1 Running 0 6s 10.244.1.6 cka-worker <none> <none># Cleanup for drill 2: delete the namespace and remove the label again
kubectl delete namespace drill-02 --wait=true
kubectl label node cka-worker disktype-Removing the nodeSelector from the Deployment would be the other way to fix it. We did not run that variant.
Drill 3: solution
# Read the error, compare it with the ConfigMap keys, then replace the ConfigMap with the right key
kubectl -n drill-03 logs deploy/report
kubectl -n drill-03 get configmap report-config -o 'jsonpath={.data}{"\n"}'
kubectl -n drill-03 create configmap report-config --from-literal=settings.conf=mode=report --dry-run=client -o yaml | kubectl replace -f -
kubectl -n drill-03 rollout restart deployment/report
kubectl -n drill-03 rollout status deployment/report --timeout=120s# Real output before the fix
cat: can't open '/etc/report/settings.conf': No such file or directory
{"setting.conf":"mode=report"}The key was setting.conf, missing the s. We ran rollout restart as part of the fix. We did not test whether the fix works without it. Check:
# Check: the Pod is Running and the app printed its setting
kubectl -n drill-03 get pods
kubectl -n drill-03 logs deploy/report# Real output
NAME READY STATUS RESTARTS AGE
report-5987f9b694-k4nzz 1/1 Running 0 8s
mode=reportloadedRun right after the rollout, the old crashing Pod can still be listed right after rollout status and kubectl logs may print a Found 2 pods line first. Repeat the check after about 20 seconds.
# Cleanup for drill 3
kubectl delete namespace drill-03 --wait=trueDrill 4: solution
# Look at the revisions, then undo the rollout
kubectl -n drill-04 rollout history deployment/shop
kubectl -n drill-04 rollout undo deployment/shop
kubectl -n drill-04 rollout status deployment/shop --timeout=120sIn our run the two old Pods stayed Running while the new Pod sat in ImagePullBackOff. We did not print the rollout strategy values. rollout undo prints a warning that is expected here: the Deployment was created with kubectl apply, and the rollback does not update the last-applied annotation.
# Real output
Warning: resource deployments/shop was previously managed with 'kubectl apply'. Rolling back will not update the kubectl.kubernetes.io/last-applied-configuration annotation, which may cause unexpected behavior on future 'kubectl apply' operations. Consider using 'kubectl apply' with your previous configuration file instead.
deployment.apps/shop rolled back
deployment "shop" successfully rolled out# Check: two Running Pods and the old image
kubectl -n drill-04 get pods
kubectl -n drill-04 get deployment shop -o 'jsonpath={.spec.template.spec.containers[0].image}{"\n"}'# Real output
NAME READY STATUS RESTARTS AGE
shop-55d488c58d-zzdm5 1/1 Running 0 31s
shop-55d488c58d-zzqv6 1/1 Running 0 31s
nginx:1.27-alpineThe failed new Pod may still show Terminating if you run the check right after rollout status.
# Cleanup for drill 4
kubectl delete namespace drill-04 --wait=trueDrill 5: solution
# See why the drain is refused, then lower the budget and drain again
kubectl -n drill-05 get pdb
kubectl -n drill-05 patch pdb queue-pdb --type merge -p '{"spec":{"minAvailable":0}}'
kubectl drain cka-worker --ignore-daemonsets --delete-emptydir-data --timeout=60sA budget of minAvailable: 2 on a Deployment with 2 replicas allows 0 disruptions, so every eviction is refused. The first drain, the one from the hint, stops at its timeout and leaves the node cordoned. Run it first, or the second output below will start with "cordoned" instead of "already cordoned".
# Real output of the first drain, the one from the hint (--timeout=20s; this command is not in the block above). Excerpt, filtered and reordered
node/cka-worker cordoned
error when evicting pods/"queue-54b865d779-2m9jh" -n "drill-05" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.# Real output of the second drain
node/cka-worker already cordoned
Warning: ignoring DaemonSet-managed Pods: kube-system/kindnet-d9925, kube-system/kube-proxy-k4pjs
evicting pod drill-05/queue-54b865d779-vddp9
evicting pod drill-05/queue-54b865d779-2m9jh
pod/queue-54b865d779-vddp9 evicted
pod/queue-54b865d779-2m9jh evicted
node/cka-worker drainedDeleting the budget would also work; we did not run that. Check:
# Check: only DaemonSet Pods are left on the worker
kubectl get pods -A -o wide --field-selector spec.nodeName=cka-worker
kubectl -n drill-05 get pods -o wide# Real output (excerpt; the node and queue Pod tables are shortened to the key columns)
kube-system kindnet-d9925 1/1 Running 0 16m
kube-system kube-proxy-k4pjs 1/1 Running 0 16m
queue-54b865d779-mbbkg 0/1 Pending 0 2s <none> <none>
queue-54b865d779-wnxx8 0/1 Pending 0 2s <none> <none>The two evicted Pods are Pending in this lab. There is one worker and the control-plane is tainted, so they have nowhere to go until the node is uncordoned. That is expected here, not a second fault. The task ends with the uncordon, which is also the cleanup:
# Cleanup for drill 5: uncordon the worker and delete the namespace
kubectl uncordon cka-worker
kubectl delete namespace drill-05 --wait=true
kubectl get nodes# Real output
node/cka-worker uncordoned
namespace "drill-05" deleted
NAME STATUS ROLES AGE VERSION
cka-control-plane Ready control-plane 16m v1.37.0
cka-worker Ready <none> 16m v1.37.0Drill 6: solution
# Add a second policy: Pods labeled role=client may reach the api Pods on port 80
kubectl apply -n drill-06 -f - <<'YAML'
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: allow-client-to-api}
spec:
podSelector: {matchLabels: {app: api}}
policyTypes: [Ingress]
ingress:
- from:
- podSelector: {matchLabels: {role: client}}
ports:
- {protocol: TCP, port: 80}
YAMLBefore the fix the request from client timed out (wget: download timed out). kindnet enforces NetworkPolicy in this version; on a cluster whose network plugin does not, this drill would show no symptom. Check both Pods:
# Check: the labeled client gets the page, the unlabeled Pod still times out
kubectl -n drill-06 exec client -- wget -qO- -T 3 http://api | head -4
kubectl -n drill-06 exec other -- wget -qO- -T 3 http://api# Real output (excerpt; the page is cut to 4 lines by head -4)
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
wget: download timed out
command terminated with exit code 1# Cleanup for drill 6
kubectl delete namespace drill-06 --wait=trueDrill 7: solution
# A Service name resolves bare only inside its own namespace; add the namespace
kubectl -n drill-07 exec client -- cat /etc/resolv.conf
kubectl -n drill-07 exec client -- wget -S -qO /dev/null -T 3 http://db.drill-07-db# Real output of the first command (resolv.conf). The last line, wget: bad address 'db', comes from kubectl -n drill-07 exec client -- wget -qO- -T 3 http://db, which no block on this page runs.
search drill-07.svc.cluster.local svc.cluster.local cluster.local
nameserver 10.96.0.10
options ndots:5
wget: bad address 'db'The only namespace in the search list is the Pod's own (drill-07). None of the entries names drill-07-db, so db alone does not resolve to the Service in the other namespace. db.drill-07-db works, and so does the full name:
# Check: resolve and fetch with the full name
kubectl -n drill-07 exec client -- nslookup db.drill-07-db.svc.cluster.local
kubectl -n drill-07 exec client -- wget -S -qO /dev/null -T 3 http://db.drill-07-db.svc.cluster.local# Real output (excerpt)
Server: 10.96.0.10
Address: 10.96.0.10:53
Name: db.drill-07-db.svc.cluster.local
Address: 10.96.216.109
HTTP/1.1 200 OKOne observation, not investigated: in this lab, nslookup db.drill-07-db with the busybox 1.37 image returned NXDOMAIN, although wget http://db.drill-07-db worked. We did not look for the cause. If you test the short form with nslookup and it fails, use the full name or wget.
# Cleanup for drill 7: both namespaces
kubectl delete namespace drill-07 drill-07-db --wait=trueDrill 8: solution
# See the event and the available classes
kubectl -n drill-08 describe pvc data
kubectl get storageclass# Real output (excerpt)
Warning ProvisioningFailed 3s (x2 over 8s) persistentvolume-controller storageclass.storage.k8s.io "fast" not found
standard (default) rancher.io/local-path Delete WaitForFirstConsumer falseThe claim asks for class fast; the only class is standard. A claim's spec is immutable, so applying over it was refused (spec is immutable after creation). Delete the Pod and the claim, and create both again with storageClassName: standard:
# Delete the Pod and the claim, then recreate both with the existing class
kubectl -n drill-08 delete pod/writer pvc/data
kubectl apply -n drill-08 -f - <<'YAML'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: {name: data}
spec:
accessModes: [ReadWriteOnce]
storageClassName: standard
resources: {requests: {storage: 100Mi}}
---
apiVersion: v1
kind: Pod
metadata: {name: writer}
spec:
containers:
- name: sh
image: busybox:1.37
command: ["sh", "-c", "echo hello > /data/out.txt && sleep 3600"]
volumeMounts: [{name: d, mountPath: /data}]
volumes: [{name: d, persistentVolumeClaim: {claimName: data}}]
YAML
kubectl -n drill-08 wait --for=condition=Ready pod/writer --timeout=120s# Check: the claim is Bound and the file was written
kubectl -n drill-08 get pvc,pod
kubectl -n drill-08 exec writer -- cat /data/out.txt# Real output (excerpt; the PVC line is shortened to its first columns)
persistentvolumeclaim/data Bound pvc-64047583-88f8-4f7f-924e-c3d97cace51c 100Mi RWO standard
pod/writer 1/1 Running 0 3s
helloThe volume is created only when the Pod is scheduled, because the class uses WaitForFirstConsumer.
# Cleanup for drill 8: the namespace, then confirm no PersistentVolume is left
kubectl delete namespace drill-08 --wait=true
kubectl get pv# Real output
namespace "drill-08" deleted
No resources foundDrill 9: solution
# Add pods/log to the Role and point the binding at the right ServiceAccount
kubectl -n drill-09 get rolebinding pod-reader -o 'jsonpath={.subjects[0].name}{"\n"}'
kubectl -n drill-09 create role pod-reader --verb=get,list --resource=pods,pods/log --dry-run=client -o yaml | kubectl apply -f -
kubectl -n drill-09 delete rolebinding pod-reader
kubectl -n drill-09 create rolebinding pod-reader --role=pod-reader --serviceaccount=drill-09:reporterTwo defects: the binding named a ServiceAccount reports (a typo, so reporter had no permission) and the Role lacked pods/log. Before the fix:
# Real output before the fix (the first line comes from the first command above; the Forbidden line comes from kubectl -n drill-09 get pods --as=system:serviceaccount:drill-09:reporter, which no block on this page runs)
reports
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:drill-09:reporter" cannot list resource "pods" in API group "" in the namespace "drill-09"# Check: yes where it must work, no for everything else, then read the log as the ServiceAccount
SA=system:serviceaccount:drill-09:reporter
kubectl auth can-i list pods -n drill-09 --as=$SA
kubectl auth can-i get pods/log -n drill-09 --as=$SA
kubectl auth can-i delete pods -n drill-09 --as=$SA
kubectl auth can-i list pods -n default --as=$SA
kubectl -n drill-09 logs sample --as=$SA# Real output
yes
yes
no
no
sample log lineThese checks run as the cluster admin with --as; a check with a real token was not part of this drill.
# Cleanup for drill 9
kubectl delete namespace drill-09 --wait=trueDrill 10: solution
# Read why the node is NotReady, look at the kubelet inside the node, start it
kubectl get node cka-worker -o 'jsonpath={.status.conditions[?(@.type=="Ready")].message}{"\n"}'
docker exec cka-worker systemctl is-active kubelet
docker exec cka-worker systemctl start kubelet
kubectl wait --for=condition=Ready node/cka-worker --timeout=120s# Real output before the fix
Kubelet stopped posting node status.
inactiveWith the kubelet stopped, the node went NotReady, its Ready condition said "Kubelet stopped posting node status.", and the node had unreachable taints. The Pod pinned to the worker still showed Running while the node was NotReady. We did not measure how long that lasts or look into why. Check:
# Check: both nodes Ready and the Pod Running on the worker
kubectl get nodes
kubectl -n drill-10 get pods -o wide# Real output (excerpt; the Pod table is shortened to the first columns)
NAME STATUS ROLES AGE VERSION
cka-control-plane Ready control-plane 19m v1.37.0
cka-worker Ready <none> 19m v1.37.0
pinned-78856cddb9-qnpv8 1/1 Running 0 47s# Cleanup for drill 10: start the kubelet again (harmless if already running), then delete the namespace
docker exec cka-worker systemctl start kubelet
kubectl delete namespace drill-10 --wait=true
kubectl get nodes4. Verify the fix, not the command
Each check above looks at the outcome a user would care about: the Service has endpoints and answers, the Pod runs on the right node, the claim is Bound, the node is Ready, the ServiceAccount gets yes where it must and no everywhere else. Do the same when you work alone: run the check, then run it again a minute later, because a Pod that is Running now can still be restarting.
5. What these drills do not cover
- etcd snapshot and restore. Not made into a drill. The
etcdctlcommand is not on the kind node image (we assume it is in the etcd Pod's image; we did not check), so a snapshot would have to run throughkubectl execinto the etcd Pod. We did not try that, and we did not try restoring a snapshot into kind's static-Pod etcd either. - kubeadm certificates.
kubeadm certs check-expirationworks on the kind control-plane node, but a healthy cluster gives it no honest "broken" state to set up, so it is not a drill. - Other versions and network plugins. Everything ran on Kubernetes v1.37.0 with kindnet. Drill 6 in particular depends on the network plugin enforcing NetworkPolicy. Re-running a setup script in a namespace that already exists was not tested.
- Time budgets are rough classes, not measurements.
- The real exam. Nothing on this page describes the real exam's environment, Kubernetes version, scoring or wording.
6. After the free drills
These drills give you broken things to fix at your own pace. They do not give you a timer or a score. If you want practice that does, a paid course or mock exam is a next step, not a requirement for these ten drills. We have not used any paid mock exam or course, so check what a specific product includes before you buy.
It is the wrong choice while you cannot yet fix the drills without looking anything up. In that case, practice more first: run the drills again, from a fresh cluster, until the fix is a sequence of commands you type without looking. A timed mock only tells you the same thing at a price.
7. Rollback and clean up
Every drill has its own cleanup. When you are done, delete the whole cluster, which also removes anything a missed cleanup left behind:
# Delete the cluster and confirm it is gone
kind delete cluster --name cka
kind get clusters# Real output
Deleting cluster "cka" ...
Deleted nodes: ["cka-control-plane" "cka-worker"]
No kind clusters found.Related guides
- Fix a Kubernetes Service with no endpoints: drill 1 in depth.
- Troubleshoot a Kubernetes Pod stuck Pending: drills 2 and 8 in depth.
- Troubleshoot a Kubernetes Pod that keeps restarting: drill 3 in depth.
- Troubleshoot Kubernetes ImagePullBackOff: drill 4 in depth.
- Inspect Kubernetes Pods, Deployments, and Services: the
kubectlreading skills every drill uses.
Sources
- kind quick start: https://kind.sigs.k8s.io/docs/user/quick-start/
- Kubernetes tasks, debugging: https://kubernetes.io/docs/tasks/debug/
- Kubernetes documentation, Specifying a Disruption Budget: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
- Certified Kubernetes Administrator curriculum (public domains): https://github.com/cncf/curriculum/tree/main/cka
Official reference
Technical steps are original explanations; consult the upstream documentation for version-specific details.
Behavior differs by distribution and tool version. Commands are examples for authorized systems; review output for secrets before sharing.
Found this useful?
Follow us on YouTube for video explainers, and find us on Facebook to keep up with what is new.