CKA Domain 2: Workloads and Scheduling
31 free practice questions for Workloads and Scheduling in the Certified Kubernetes Administrator (CKA) exam. Try each question first, then open "Show answer" for the correct option and explanation.
Workloads and Scheduling practice questions
-
Question 1. Which command changes the image of the nginx container in Deployment web to nginx:1.27?
Show answer
Answer: B. kubectl set image deployment/web nginx=nginx:1.27
set image triggers a rolling update of the Deployment's Pods.
-
Question 2. A new Deployment revision is failing. Which command returns to the previous revision?
Show answer
Answer: C. kubectl rollout undo deployment/web
rollout undo reverts to the previous revision. --to-revision picks a specific one.
-
Question 3. Which command shows the revision history of a Deployment?
Show answer
Answer: A. kubectl rollout history deployment/web
History lists revisions, with change causes if annotated.
-
Question 4. In a RollingUpdate strategy, what does maxUnavailable: 0 with maxSurge: 1 mean?
Show answer
Answer: A. A new Pod starts before an old one stops, so capacity never drops
maxSurge allows extra Pods above the desired count, and maxUnavailable limits how many can be down.
-
Question 5. Which Deployment strategy terminates all old Pods before creating new ones?
Show answer
Answer: C. Recreate
Recreate causes downtime but ensures old and new versions never run at the same time.
-
Question 6. Which object stores non-sensitive configuration, such as an application's settings file?
Show answer
Answer: D. ConfigMap
ConfigMaps hold configuration data. Secrets are for sensitive values.
-
Question 7. How are values in a Kubernetes Secret stored in its manifest by default?
Show answer
Answer: A. Base64-encoded, which is not encryption
Base64 is only encoding. Enable encryption at rest in etcd and restrict RBAC access to Secrets.
-
Question 8. Which command creates a Secret with a password key from the command line?
Show answer
Answer: A. kubectl create secret generic db --from-literal=password=S3cret
generic Secrets accept --from-literal, --from-file, or --from-env-file.
-
Question 9. How can every key in ConfigMap app-config become environment variables in a container?
Show answer
Answer: D. Use envFrom with configMapRef: name: app-config
envFrom imports all keys. env with valueFrom picks individual keys.
-
Question 10. A ConfigMap is mounted as a volume. What happens when the ConfigMap is updated?
Show answer
Answer: D. The mounted files are updated after a short delay
Volume-mounted ConfigMaps refresh eventually. Environment variables don't update until the Pod restarts.
-
Question 11. Which object automatically scales the number of Pods in a Deployment based on CPU usage?
Show answer
Answer: A. HorizontalPodAutoscaler
HPA changes replica counts. VPA adjusts resource requests of the Pods.
-
Question 12. Which command creates an HPA for Deployment web targeting 70% CPU, between 2 and 10 replicas?
Show answer
Answer: D. kubectl autoscale deployment web --cpu-percent=70 --min=2 --max=10
kubectl autoscale creates a HorizontalPodAutoscaler object.
-
Question 13. An HPA shows <unknown> for current CPU usage. What is the MOST likely cause?
Show answer
Answer: B. The metrics server isn't installed or Pods have no CPU requests
HPA needs resource metrics and CPU requests to calculate utilization percentages.
-
Question 14. What does a liveness probe do when it fails repeatedly?
Show answer
Answer: C. The kubelet restarts the container
Liveness probes detect stuck containers. Readiness probes control whether a Pod receives traffic.
-
Question 15. What happens when a readiness probe fails?
Show answer
Answer: C. The Pod is removed from Service endpoints until it passes
Readiness gates traffic without restarting the container.
-
Question 16. An application takes up to 3 minutes to start. Which probe prevents the liveness probe from killing it during startup?
Show answer
Answer: B. A startup probe
Liveness and readiness checks wait until the startup probe succeeds.
-
Question 17. What is the difference between resource requests and limits?
Show answer
Answer: B. Requests are used for scheduling; limits cap what a container can use
The scheduler places Pods based on requests. Exceeding a memory limit gets the container OOM-killed.
-
Question 18. A container exceeds its memory limit. What happens?
Show answer
Answer: A. It is terminated with OOMKilled
Memory can't be throttled, so exceeding the limit kills the container. CPU over the limit is throttled.
-
Question 19. Which field schedules a Pod only onto nodes labeled disktype=ssd, in its simplest form?
Show answer
Answer: D. nodeSelector: {disktype: ssd}
nodeSelector is the simplest node constraint. Node affinity provides more expressive rules.
-
Question 20. Which feature lets a Pod prefer, but not require, nodes in a specific zone?
Show answer
Answer: D. preferredDuringSchedulingIgnoredDuringExecution node affinity
Preferred rules add weight to matching nodes. Required rules must be satisfied.
-
Question 21. A node has the taint gpu=true:NoSchedule. Which Pods can be scheduled on it?
Show answer
Answer: A. Only Pods with a matching toleration
Taints repel Pods without a matching toleration. A toleration allows, but doesn't force, scheduling there.
-
Question 22. Which taint effect also evicts running Pods that don't tolerate it?
Show answer
Answer: A. NoExecute
NoExecute affects running Pods. NoSchedule affects only new scheduling decisions.
-
Question 23. Which command removes the taint gpu=true:NoSchedule from node1?
Show answer
Answer: A. kubectl taint nodes node1 gpu=true:NoSchedule-
Adding a trailing minus sign removes the taint.
-
Question 24. Which workload type runs one Pod on every node, for example a log collector?
Show answer
Answer: A. DaemonSet
DaemonSets add a Pod when a node joins and remove it when the node leaves.
-
Question 25. Which workload type gives Pods stable names and persistent storage per replica, such as db-0 and db-1?
Show answer
Answer: D. StatefulSet
StatefulSets provide ordered deployment, stable network identities, and volumeClaimTemplates.
-
Question 26. Which object runs a task to completion, such as a database migration?
Show answer
Answer: D. Job
Jobs run Pods until they complete successfully. CronJobs run Jobs on a schedule.
-
Question 27. Which object runs a Job every night at 2 a.m.?
Show answer
Answer: A. CronJob with schedule "0 2 * * *"
CronJobs use standard cron syntax to create Jobs on a schedule.
-
Question 28. What sets default CPU and memory requests for containers that don't specify them in a namespace?
Show answer
Answer: A. A LimitRange
LimitRange sets defaults and min/max values. ResourceQuota caps the namespace's total usage.
-
Question 29. What does a ResourceQuota do in a namespace?
Show answer
Answer: D. Caps total resource use and object counts
Quotas prevent one team from consuming all cluster resources.
-
Question 30. Which Pod field makes the scheduler bypass normal scheduling and place the Pod on a specific node?
Show answer
Answer: B. nodeName
nodeName assigns the Pod directly. It's rarely used because it skips scheduler checks.
-
Question 31. A Deployment must keep at least one replica of its Pods on each of three zones. Which Pod spec field spreads replicas evenly?
Show answer
Answer: D. topologySpreadConstraints
Topology spread constraints balance Pods across zones, nodes, or other topology domains using node labels.
CKA, Certified Kubernetes Administrator, and Kubernetes are trademarks of The Linux Foundation. These questions are original study material, not questions from the real exam.