Kubernetes MCQs – Workloads and Scheduling

11.) What is node affinity used for?

A) Volume mounting
B) Logging
C) Scheduling pods to specific nodes
D) Debugging pods

Answer: Option C

Explanation: Node affinity defines rules for pod placement based on node labels.

12.) What are taints and tolerations used for in Kubernetes?

A) Setting environment variables
B) Managing logging levels
C) Controlling pod scheduling
D) Creating services

Answer: Option C

Explanation: Taints prevent pods from being scheduled on nodes unless the pods tolerate the taints.

13.) What happens when a node is tainted and a pod does not have a toleration?

A) The pod runs anyway
B) The pod is not scheduled on that node
C) The pod is deleted
D) The pod restarts

Answer: Option B

Explanation: Without a matching toleration, the pod won’t be placed on the tainted node.

14.) Which controller allows you to roll back to a previous version?

A) Job
B) StatefulSet
C) Deployment
D) DaemonSet

Answer: Option C

Explanation: Deployments support rolling back to previous versions using kubectl rollout undo.

15.) What does a rolling update strategy do in a Deployment?

A) Deletes all pods and creates new ones
B) Updates all at once
C) Creates a StatefulSet
D) Updates pods gradually

Answer: Option D

Explanation: Rolling updates replace old pods with new ones incrementally.

16.) How does Kubernetes ensure that the desired number of pods are always running?

A) By using kube-scheduler
B) Through the etcd database
C) Via controllers like ReplicaSet and Deployment
D) By restarting the API server

Answer: Option C

Explanation: These controllers ensure the number of running pods matches the desired state.

17.) What is the default restart policy for Kubernetes pods managed by a Deployment?

A) Always
B) OnFailure
C) Never
D) Manual

Answer: Option A

Explanation: The default restart policy for pods in a Deployment is Always.

18.) Which object allows scheduled tasks using cron syntax?

A) Deployment
B) Job
C) CronJob
D) Pod

Answer: Option C

Explanation: CronJobs use cron format to schedule jobs at specific times.

19.) What command shows running jobs in Kubernetes?

A) kubectl get jobs
B) kubectl get tasks
C) kubectl get cron
D) kubectl list jobs

Answer: Option A

Explanation: This command lists all Job resources and their statuses.

20.) What controller is best for running a database with persistent storage?

A) Deployment
B) DaemonSet
C) StatefulSet
D) Job

Answer: Option C

Explanation: StatefulSet maintains identity and persistent storage per replica—ideal for databases.

Leave a Reply

Your email address will not be published. Required fields are marked *