Kubernetes MCQs – Best Practices and Real-World Use Cases

11.) What is the best way to roll out changes to a live application with zero downtime?

A) Restart pods
B) Use rolling updates
C) Use recreate strategy
D) Delete pods first

Answer: Option B

Explanation: Rolling updates gradually replace pods, ensuring service availability.

12.) What command applies a manifest only if it changes from the existing state?

A) kubectl create -f
B) kubectl update -f
C) kubectl sync -f
D) kubectl apply -f

Answer: Option D

Explanation: This command applies updates idempotently, only when needed.

13.) What is a common use case for Kubernetes Jobs?

A) Hosting web apps
B) Running one-time batch processes
C) Monitoring resources
D) Autoscaling

Answer: Option B

Explanation: Jobs are used for non-repeating tasks like backups and database migrations.

14.) How can you debug a failed pod?

A) kubectl get svc
B) kubectl restart pod
C) kubectl describe pod <name>
D) kubectl port-forward

Answer: Option C

Explanation: This shows detailed info about pod events, status, and reasons for failure.

15.) How can you scale a deployment to 10 replicas?

A) kubectl scale –replicas=10 deployment/ <name>
B) kubectl rollout replicas 10
C) kubectl pod scale 10
D) kubectl update podcount 10

Answer: Option A

Explanation: This command explicitly sets the number of replicas for a deployment.

16.) Which controller ensures the desired number of pod replicas are always running?

A) DaemonSet
B) CronJob
C) ReplicaSet
D) StatefulSet

Answer: Option C

Explanation: ReplicaSet maintains a stable set of replica pods running at all times.

17.) What is a good use case for StatefulSets?

A) Stateless applications
B) Temporary jobs
C) High-performance computing
D) Persistent storage and ordered deployment

Answer: Option D

Explanation: StatefulSets are ideal for databases and other stateful applications.

18.) How can you monitor cluster health effectively?

A) Use Kubernetes logs
B) Install Prometheus and Grafana
C) Increase replicas
D) Watch pods manually

Answer: Option B

Explanation: Prometheus and Grafana are widely used tools for monitoring Kubernetes clusters.

19.) What does the kubectl rollout undo command do?

A) Deletes all resources
B) Restarts all pods
C) Rolls back to the previous deployment
D) Undeploys all manifests

Answer: Option C

Explanation: This command rolls back to the last working version of the deployment.

20.) What is the purpose of using resource quotas in namespaces?

A) To limit resource usage per namespace
B) For image versioning
C) For access control
D) To restart pods

Answer: Option A

Explanation: Quotas help avoid one namespace consuming all cluster resources.

Leave a Reply

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