Kubernetes MCQs – Workloads and Scheduling

Kubernetes is designed to manage containerized applications at scale. Its core strength lies in orchestrating workloads using various controllers like Deployments, StatefulSets, DaemonSets, and Jobs. Scheduling determines how and where pods run in a cluster, using rules and constraints like node affinity, taints, and tolerations.

Understanding workloads and scheduling is critical for deploying reliable applications that scale and recover effectively. These MCQs will help you assess and strengthen your understanding of Kubernetes workloads and scheduling mechanisms.

1.) Which Kubernetes object ensures that a specified number of pod replicas are running at all times?

A) Pod
B) Deployment
C) Service
D) ConfigMap

Answer: Option B

Explanation: A Deployment manages ReplicaSets to ensure the desired number of pods are running.

2.) What does a DaemonSet ensure?

A) A pod runs on every worker node
B) Only one pod runs per cluster
C) Replication is maintained
D) Volume is attached

Answer: Option A

Explanation: DaemonSets ensure a copy of the pod runs on each node, often used for monitoring or logging agents.

3.) Which object manages a group of identical pods?

A) Node
B) Pod
C) ReplicaSet
D) ConfigMap

Answer: Option C

Explanation: A ReplicaSet maintains a stable set of pod replicas.

4.) What is the primary function of the Kubernetes scheduler?

A) Creates pods
B) Updates services
C) Assigns pods to nodes
D) Stores configuration

Answer: Option C

Explanation: The scheduler is responsible for selecting a node for the unscheduled pods based on constraints and available resources.

5.) Which controller is ideal for batch jobs and one-time tasks?

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

Answer: Option A

Explanation: A Job runs pods to completion, typically used for one-time or batch operations.

6.) What is a StatefulSet primarily used for?

A) Stateless applications
B) Logging services
C) Creating jobs
D) Applications requiring stable network IDs and persistent storage

Answer: Option D

Explanation: StatefulSets maintain identity and persistent volumes for stateful applications like databases.

7.) What does a CronJob do in Kubernetes?

A) Runs a pod only once
B) Deletes old deployments
C) Schedules jobs periodically
D) Schedules pod restarts

Answer: Option C

Explanation: CronJobs run Jobs on a scheduled basis using cron syntax.

8.) What happens when a pod fails in a Job?

A) The Job deletes the pod
B) It tries again based on backoffLimit
C) The node is tainted
D) The service is restarted

Answer: Option B

Explanation: A Job retries a failed pod according to the configured backoff limit.

9.) Which controller should you use for ensuring high availability of a stateless app?

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

Answer: Option B

Explanation: Deployments ensure the desired number of stateless pods are always available.

10.) Which field in a PodSpec influences scheduling decisions?

A) affinity
B) containers
C) labels
D) annotations

Answer: Option A

Explanation: The affinity field is used to influence which nodes a pod should be scheduled to.

Leave a Reply

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