Kubernetes CKA Exam Prep: 20 Hands-On Practice Questions and Solutions

Written by, Issam on April 4, 2025

devops

Below are 20 exam-style questions along with answers, detailed explanations, tips, and alternative approaches. These questions cover many core topics in the CKA exam (post-February 2025 update). Each solution uses the k alias for kubectl, and where appropriate, alternative commands or methods are provided. Use these as practice prompts and adjust them based on your lab environment.


1. Create a Pod

Question: Create a Pod named nginx-pod that runs the nginx image.
Answer:

k run nginx-pod --image=nginx --restart=Never

Explanation:


2. Generate Pod YAML

Question: Generate the YAML definition for a Pod running busybox that executes sleep 3600, and save it to a file.
Answer:

k run busybox --image=busybox --restart=Never --command -- sleep 3600 --dry-run=client -o yaml > busybox.yaml

Explanation:


3. Create a Deployment

Question: Create a Deployment named web-deploy using the nginx image with 3 replicas.
Answer:

k create deployment web-deploy --image=nginx
k scale deploy web-deploy --replicas=3

Explanation:


4. Expose a Deployment as a Service

Question: Expose the web-deploy Deployment on port 80 as a NodePort service.
Answer:

k expose deployment web-deploy --name=web-svc --type=NodePort --port=80

Explanation:


5. Create a ConfigMap and Use It

Question: Create a ConfigMap named app-config with an environment variable ENV=prod and use it in a Pod.
Answer:

k create configmap app-config --from-literal=ENV=prod

Explanation:


6. Create a Secret and Mount It

Question: Create a Secret named db-secret with keys username=admin and password=secret123, then mount it in a Pod at /etc/db-secret.
Answer:

k create secret generic db-secret --from-literal=username=admin --from-literal=password=secret123

Explanation:


7. Create a PVC and Mount It in a Pod

Question: Create a PersistentVolumeClaim named mypvc requesting 1Gi of storage, and mount it in a Pod at /data.
Answer:

Explanation:


8. Apply a NetworkPolicy

Question: Create a NetworkPolicy that allows ingress to Pods labeled app=nginx only from Pods with label role=frontend.
Answer:

Explanation:


9. Use Node Labeling and Node Selector

Question: Label a node node1 with disktype=ssd and then ensure a Pod is scheduled only on nodes with that label.
Answer:

Explanation:


10. Taint a Node and Add a Toleration

Question: Taint node1 with env=prod:NoSchedule and create a Pod that tolerates that taint.
Answer:

Explanation:


11. Cordon, Drain, and Uncordon a Node

Question: Prepare node1 for maintenance by preventing new Pod scheduling and safely evicting existing Pods.
Answer:

k cordon node1
k drain node1 --ignore-daemonsets --delete-emptydir-data
k uncordon node1

Explanation:


12. Create a Job to Calculate Pi

Question: Create a Job named pi-job that calculates Pi to 2000 digits using a Perl command.
Answer:

Explanation:


13. Create a CronJob

Question: Create a CronJob named hello that runs every minute and prints “Hi”.
Answer:

k create cronjob hello --image=busybox --schedule="*/1 * * * *" -- /bin/sh -c "echo Hi"

Explanation:


14. RBAC: Create Role and RoleBinding

Question: Grant a user dev permission to list and get pods in the dev namespace using RBAC.
Answer:

Explanation:


15. Work with CRDs and Custom Resources

Question: List all Custom Resource Definitions and show details for one custom resource.
Answer:

k get crds
k explain <custom-resource>

Explanation:


16. Use Helm to Deploy an Application

Question: Deploy an application using Helm from the Bitnami repository.
Answer:

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install myapp bitnami/nginx

Explanation:


17. Use Kustomize for Overlays

Question: Apply configuration overlays with Kustomize from a directory.
Answer:

k apply -k ./overlays/dev

Explanation:


18. Troubleshoot a Failing Pod

Question: A Pod is in CrashLoopBackOff. Diagnose and retrieve logs.
Answer:

k describe pod <pod-name>
k logs <pod-name>

Explanation:


19. Monitor Cluster Resource Usage

Question: Check CPU and memory usage of pods and nodes.
Answer:

k top pod
k top node

Explanation:


20. Validate YAML before Applying

Question: Validate a Kubernetes manifest without applying any changes.
Answer:

k apply -f file.yaml --dry-run=client -o yaml

Explanation:


These 20 questions cover a wide range of topics—from basic pod creation to advanced RBAC, Helm, CRDs, and troubleshooting—that are representative of the CKA exam post-Feb 2025. Reviewing the commands, experimenting in a lab environment (using tools like Killercoda, Killer.sh, Minikube, or KIND), and understanding alternative approaches will strengthen your exam readiness.

Good luck with your preparation! Let me know if you have any questions or need further clarifications on any of these topics.