Kubernetes MCQs – Introduction to Kubernetes

11.) Which of the following best defines a Kubernetes Service?

A) A container runtime
B) A set of pods with shared storage
C) A stable endpoint for accessing pods
D) A pod configuration file

Answer: Option C

Explanation: A Service in Kubernetes provides a permanent IP and DNS name for a set of pods.

12.) How does Kubernetes ensure the desired state in the cluster?

A) Through manual configuration
B) Using configuration files
C) Through controllers that monitor and apply changes
D) By restarting nodes

Answer: Option C

Explanation: Controllers continuously compare the desired state with the current state and take actions to reconcile them.

13.) What is a ReplicaSet used for?

A) Managing volumes
B) Scaling nodes
C) Ensuring a specified number of pod replicas are running
D) Assigning permissions

Answer: Option C

Explanation: A ReplicaSet maintains the desired number of identical pods.

14.) Which object manages updates and rollbacks in Kubernetes?

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

Answer: Option C

Explanation: A Deployment manages ReplicaSets and provides features like rolling updates and rollbacks.

15.) What is the default namespace used when none is specified?

A) kube-system
B) default
C) production
D) app-space

Answer: Option B

Explanation: Kubernetes uses the “default” namespace if no other is specified in a resource manifest or command.

16.) What is a label in Kubernetes?

A) A service name
B) A way to identify resources
C) A type of secret
D) A container image

Answer: Option B

Explanation: Labels are key-value pairs attached to objects, used for identification and selection.

17.) Which command lists all pods in all namespaces?

A) kubectl get pods
B) kubectl get all-pods
C) kubectl get pods –all-namespaces
D) kubectl pods –all

Answer: Option C

Explanation: The –all-namespaces flag lists pods across all namespaces.

18.) Which component in Kubernetes schedules pods to nodes?

A) kube-controller-manager
B) kube-scheduler
C) kubelet
D) etcd

Answer: Option B

Explanation: The kube-scheduler assigns pods to available nodes based on resource requirements and other constraints.

19.) How do Pods communicate with each other in a cluster?

A) Through kubelet
B) Using hostnames
C) Using virtual IPs assigned by Services
D) Direct DNS routing

Answer: Option C

Explanation: Services provide a stable IP that enables communication between pods.

20.) Which Kubernetes component ensures that containers in a pod are running and healthy?

A) etcd
B) kube-proxy
C) kubelet
D) controller-manager

Answer: Option C

Explanation: The kubelet ensures containers are running in a pod and restarts them if they fail.

Leave a Reply

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