CKAD Dump 2 — Questions and Answers
Question 1: A pod is stuck in 'Pending' state. Which command helps you identify the root cause?
- kubectl logs <pod>
- kubectl describe pod <pod> (Correct answer)
- kubectl exec <pod> -- sh
- kubectl get pod <pod> -o yaml | grep status
Correct answer: kubectl describe pod <pod>
kubectl describe pod shows Events section which reveals scheduling failures, resource constraints, or image pull errors.
Question 2: Which field in a Pod spec defines the restart policy?
- spec.containers[].restartPolicy
- spec.restartPolicy (Correct answer)
- metadata.restartPolicy
- spec.policy.restart
Correct answer: spec.restartPolicy
spec.restartPolicy is a pod-level field with values Always, OnFailure, or Never.
Question 3: You need a container to run as a specific user ID. Which field do you configure?
- spec.containers[].securityContext.runAsUser (Correct answer)
- spec.securityContext.userId
- spec.containers[].user
- metadata.annotations.runAsUser
Correct answer: spec.containers[].securityContext.runAsUser
securityContext.runAsUser at the container level sets the UID the process runs as.
Question 4: A Deployment has 5 replicas. You apply a rolling update with maxUnavailable=1 and maxSurge=1. What is the maximum number of pods running at any time during the update?
- 5
- 6 (Correct answer)
- 7
- 4
Correct answer: 6
maxSurge=1 allows one extra pod above the desired count, so 5+1=6 pods can run simultaneously.
Question 5: Which command scales a Deployment named 'web' to 3 replicas immediately?
- kubectl set replicas deployment/web 3
- kubectl scale deployment web --replicas=3 (Correct answer)
- kubectl edit deployment web --replicas=3
- kubectl rollout scale web=3
Correct answer: kubectl scale deployment web --replicas=3
kubectl scale deployment <name> --replicas=<n> is the imperative command to change replica count.
Question 6: What is the purpose of a Kubernetes ConfigMap?
- To store encrypted secrets
- To define network policies
- To decouple configuration data from container images (Correct answer)
- To manage persistent volume claims
Correct answer: To decouple configuration data from container images
ConfigMaps store non-sensitive configuration data as key-value pairs that pods can consume via env vars or volume mounts.
Question 7: Which probe type checks if a container is ready to accept traffic?
- livenessProbe
- startupProbe
- readinessProbe (Correct answer)
- healthProbe
Correct answer: readinessProbe
readinessProbe determines when a pod is ready to receive traffic; failing pods are removed from Service endpoints.
A pod is stuck in 'Pending' state.
Which command helps you identify the root cause?