CKAD Dump 3 — Questions and Answers
Question 1: You want to run a one-time batch task that must complete successfully. Which Kubernetes resource is most appropriate?
- Deployment
- DaemonSet
- Job (Correct answer)
- CronJob
Correct answer: Job
A Job runs pods to completion and tracks successful completions, making it ideal for batch tasks.
Question 2: Which command shows the rollout history of a Deployment named 'api'?
- kubectl history deployment api
- kubectl rollout history deployment api (Correct answer)
- kubectl get deployment api --history
- kubectl describe deployment api --rollout
Correct answer: kubectl rollout history deployment api
kubectl rollout history deployment <name> lists previous revision records for the deployment.
Question 3: A container needs read-only access to a Secret. What is the recommended method?
- Mount the Secret as a read-only volume (Correct answer)
- Inject the Secret via env var with readOnly: true
- Use a ConfigMap instead
- Store the Secret in a PersistentVolume
Correct answer: Mount the Secret as a read-only volume
Mounting Secrets as read-only volumes (readOnly: true) limits exposure and prevents accidental writes.
Question 4: Which resource limits field prevents a container from using more than the specified CPU?
- resources.requests.cpu
- resources.limits.cpu (Correct answer)
- spec.cpuQuota
- containers.cpuMax
Correct answer: resources.limits.cpu
resources.limits.cpu is enforced by cgroups and throttles the container if it exceeds the specified value.
Question 5: How do you create a Service that exposes a Deployment externally on a static port across all cluster nodes?
- type: ClusterIP
- type: NodePort (Correct answer)
- type: ExternalName
- type: Headless
Correct answer: type: NodePort
NodePort services open a port on every node and route external traffic to the backend pods.
Question 6: Which kubectl command applies a manifest file and also prunes resources no longer defined in the file?
- kubectl apply -f file.yaml
- kubectl apply -f file.yaml --prune (Correct answer)
- kubectl replace -f file.yaml
- kubectl sync -f file.yaml
Correct answer: kubectl apply -f file.yaml --prune
kubectl apply --prune removes cluster objects that match the selector but are absent from the applied manifest.
Question 7: A pod must be scheduled only on nodes labeled 'env=production'. Which mechanism enforces this?
- podAffinity
- nodeSelector (Correct answer)
- taints
- resourceQuota
Correct answer: nodeSelector
nodeSelector is the simplest way to constrain a pod to nodes with specific labels.
You want to run a one-time batch task that must complete successfully.
Which Kubernetes resource is most appropriate?