CKAD CKAD 5 — Questions and Answers
Question 1: You need a Pod to have access to the Kubernetes API server using a specific ServiceAccount. Which field in the Pod spec assigns it?
- spec.serviceAccount
- spec.serviceAccountName (Correct answer)
- spec.rbac.serviceAccount
- metadata.serviceAccountRef
Correct answer: spec.serviceAccountName
spec.serviceAccountName is the correct Pod spec field for associating a ServiceAccount with a Pod.
Question 2: What happens to an emptyDir volume when the Pod it belongs to is deleted?
- The data is persisted to the node's disk
- The data is transferred to a PersistentVolume
- The volume and all its data are deleted permanently (Correct answer)
- The volume is converted to a hostPath volume
Correct answer: The volume and all its data are deleted permanently
emptyDir volumes are ephemeral; when the Pod is removed from a node, the directory and its contents are deleted.
Question 3: Which kubectl command streams live logs from all containers in a Pod with multiple containers?
- kubectl logs <pod> --all
- kubectl logs <pod> --all-containers=true (Correct answer)
- kubectl logs <pod> --multi
- kubectl logs <pod> -c all
Correct answer: kubectl logs <pod> --all-containers=true
The --all-containers=true flag tells kubectl logs to stream output from every container in the specified Pod.
Question 4: A Deployment has 5 replicas and maxSurge=1, maxUnavailable=0 in its rolling update strategy. What is the maximum number of Pods running at any point during the update?
- 5
- 6 (Correct answer)
- 4
- 10
Correct answer: 6
With maxSurge=1 and 5 desired replicas, Kubernetes can create 1 extra Pod during the rollout, for a total of 6 running Pods.
Question 5: Which resource defines the minimum number of Pods that must be available during voluntary disruptions like node drains?
- ResourceQuota
- LimitRange
- PodDisruptionBudget (Correct answer)
- HorizontalPodAutoscaler
Correct answer: PodDisruptionBudget
A PodDisruptionBudget (PDB) specifies minAvailable or maxUnavailable to protect application availability during voluntary disruptions.
Question 6: A container must share the same process namespace as another container in the same Pod to send signals between them. Which setting enables this?
- spec.shareProcessNamespace: true (Correct answer)
- spec.containers[].ipc: shared
- spec.hostPID: true
- spec.containers[].securityContext.allowSignals: true
Correct answer: spec.shareProcessNamespace: true
Setting shareProcessNamespace: true at the Pod spec level makes all containers in the Pod share a single process namespace.
Question 7: Which command executes an interactive bash shell in a running container named 'api' within Pod 'my-pod'?
- kubectl run -it my-pod --container=api -- /bin/bash
- kubectl exec -it my-pod -c api -- /bin/bash (Correct answer)
- kubectl attach my-pod -c api --tty
- kubectl debug my-pod -c api -- /bin/bash
Correct answer: kubectl exec -it my-pod -c api -- /bin/bash
kubectl exec -it with the -c flag targets a specific container in a multi-container Pod and opens an interactive shell.
You need a Pod to have access to the Kubernetes API server using a specific ServiceAccount.
Which field in the Pod spec assigns it?