WebMagicInformatica
CKA practice questions

CKA practice questions: Workloads and Scheduling

5 free questions on Workloads and Scheduling, 15% of the Kubernetes: CKA exam. Try each one, then open the answer and explanation. None of them are in the free readiness check, so you can still take it fresh.

Question 1

A node was tainted with kubectl taint nodes node01 dedicated=gpu:NoSchedule. A Pod must be allowed to schedule onto that node. Which toleration in the Pod spec matches the taint?

  1. A.
    tolerations:
    - key: "dedicated"
      operator: "Equal"
      value: "gpu"
      effect: "NoExecute"
  2. B.
    tolerations:
    - key: "gpu"
      operator: "Equal"
      value: "dedicated"
      effect: "NoSchedule"
  3. C.
    tolerations:
    - key: "dedicated"
      operator: "Equal"
      value: "gpu"
      effect: "NoSchedule"
  4. D.
    tolerations:
    - key: "dedicated"
      operator: "Equal"
      value: "cpu"
      effect: "NoSchedule"
Show answer and explanation

Answer: C

A toleration matches a taint when the key, value (for Equal) and effect agree. Here that is dedicated=gpu with NoSchedule. Note that a toleration only permits scheduling; to force Pods onto the node you also need a nodeSelector or node affinity.

  • NoExecute is a different effect.
  • Key and value are swapped in the second option.
  • The value cpu does not equal gpu.
Question 2

A Pod must run only on nodes labelled disktype=ssd, and should prefer (but not require) nodes labelled zone=a. Which node affinity configuration expresses this?

  1. A.

    preferredDuringSchedulingIgnoredDuringExecution for disktype In [ssd], plus requiredDuringSchedulingIgnoredDuringExecution for zone In [a].

  2. B.

    requiredDuringSchedulingIgnoredDuringExecution for both disktype In [ssd] and zone In [a].

  3. C.

    preferredDuringSchedulingIgnoredDuringExecution for both labels, each with weight 100.

  4. D.

    requiredDuringSchedulingIgnoredDuringExecution with a matchExpressions rule disktype In [ssd], plus preferredDuringSchedulingIgnoredDuringExecution with a weighted preference zone In [a].

Show answer and explanation

Answer: D

required... is a hard constraint and preferred... is a soft scoring hint. The hard requirement is the disk type, the preference is the zone.

  • Swapping them would make the zone mandatory and the disk type optional.
  • Making both required would leave Pods unscheduled if no zone-a SSD node has capacity.
  • Making both preferred would allow non-SSD nodes.
Question 3

A rollout of deployment/web to a new image tag is failing: new Pods are in ImagePullBackOff and the old ReplicaSet is still serving traffic. You need to return to the previous working revision as fast as possible. Which command do you run?

  1. A.

    kubectl rollout restart deployment/web

  2. B.

    kubectl rollout undo deployment/web

  3. C.

    kubectl rollout pause deployment/web

  4. D.

    kubectl scale deployment/web --replicas=0

Show answer and explanation

Answer: B

kubectl rollout undo rolls the Deployment back to the previous ReplicaSet revision (add --to-revision=N for a specific one).

  • rollout restart re-creates Pods with the same (bad) template.
  • rollout pause just freezes the rollout in its current, partly broken state.
  • Scaling to zero causes an outage and fixes nothing.
Question 4

You must see which container image the Deployment web used in revision 2 of its rollout history. Which command shows the Pod template of that revision?

  1. A.

    kubectl get deployment web --revision=2

  2. B.

    kubectl logs deployment/web --revision=2

  3. C.

    kubectl rollout history deployment/web (without any other flags)

  4. D.

    kubectl rollout history deployment/web --revision=2

Show answer and explanation

Answer: D

--revision=N prints the details, including the Pod template and images, of that revision.

  • get and logs have no --revision flag.
  • Without --revision, the command only lists revision numbers and change causes.
Question 5

The database password is stored in a Secret and is rotated regularly. Running Pods must see the new value without a restart. How should the Secret be consumed?

  1. A.

    Mount it as a Secret volume (without subPath); the kubelet refreshes the projected files.

  2. B.

    Expose it through env with secretKeyRef.

  3. C.

    Expose it through envFrom with secretRef.

  4. D.

    Mount it as a volume using subPath for the single file.

Show answer and explanation

Answer: A

Secret volumes are updated eventually after the Secret changes. Environment variables are read only at container start, and subPath mounts do not receive updates.

  • Both environment-variable approaches need a restart.
  • subPath mounts are not refreshed.

How ready are you for CKA?

Take the free readiness check: 15 questions from every exam domain in 20 minutes, with your score per domain.

  • 20 minutes
  • 15 questions
  • Free with an account

More CKA practice by topic

Back to the CKA practice test →

Independent practice material written from the official exam guide. Not affiliated with or endorsed by the exam provider.