Kubernetes MCQ Banner

Kubernetes Multiple Choice Questions (MCQs) and Answers

Master Kubernetes with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Kubernetes concepts. Begin your placement preparation journey now!

Q31

Q31 What is the primary purpose of a Service in Kubernetes?

A

To expose pods

B

To schedule pods

C

To manage storage

D

To restart pods

Q32

Q32 Which type of Kubernetes service is used for internal cluster communication?

A

NodePort

B

LoadBalancer

C

ClusterIP

D

ExternalName

Q33

Q33 What does a NodePort service do?

A

Exposes the app on a random port

B

Exposes the app on a fixed port

C

Exposes only internally

D

Does not expose the app

Q34

Q34 What is the role of kube-proxy in networking?

A

Manages DNS

B

Routes traffic to services

C

Assigns IPs to pods

D

Monitors pod health

Q35

Q35 Which protocol is supported by Kubernetes services by default?

A

HTTP

B

TCP

C

FTP

D

SMTP

Q36

Q36 How can a LoadBalancer service expose an app on multiple external IPs?

A

By adding annotations

B

By using multiple pods

C

By using a ReplicaSet

D

Not possible

Q37

Q37 Which command retrieves the IP of a ClusterIP service?

A

kubectl get pod

B

kubectl get svc

C

kubectl describe pod

D

kubectl get clusterip

Q38

Q38 How do you expose a deployment as a NodePort service?

A

kubectl create service nodeport

B

kubectl expose deployment

C

kubectl get nodeport

D

kubectl edit service

Q39

Q39 How do you specify a custom port for a NodePort service in YAML?

A

spec.ports[].port

B

spec.type.port

C

spec.ports[].nodePort

D

spec.service.port

Q40

Q40 A pod is unreachable despite a valid ClusterIP service. What might be the issue?

A

Pod not ready

B

Incorrect labels

C

Service not created

D

Network policy blocking traffic

Q41

Q41 A NodePort service is not accessible externally. What could be the reason?

A

Firewall blocking

B

Pod crash

C

Incorrect labels

D

Missing deployment

Q42

Q42 A LoadBalancer service is not exposing an external IP. What could be the cause?

A

Misconfigured LoadBalancer

B

Unreachable pods

C

ClusterIP misconfigured

D

Node crash

Q43

Q43 What is the purpose of ConfigMaps in Kubernetes?

A

Store binary data

B

Store configuration data

C

Store pod logs

D

Store images

Q44

Q44 How is data stored in a Kubernetes Secret?

A

As plain text

B

As JSON

C

As Base64 encoded

D

As YAML

Q45

Q45 Can ConfigMaps store sensitive data like passwords?

A

Yes

B

No

C

Only in JSON

D

Only in YAML

Q46

Q46 How are ConfigMaps typically consumed by a pod?

A

Mounted as volumes

B

Directly accessed

C

Using kube-proxy

D

With a deployment

Q47

Q47 What type of Kubernetes object is a Secret?

A

Pod

B

Deployment

C

Cluster-wide resource

D

Namespaced resource

Q48

Q48 How can you restrict access to a Secret in Kubernetes?

A

By using RBAC

B

By setting permissions in YAML

C

By modifying kubelet

D

By using labels

Q49

Q49 How do you create a ConfigMap from a file?

A

kubectl apply -f

B

kubectl create configmap

C

kubectl set config

D

kubectl describe configmap

Q50

Q50 Which field in a pod spec is used to reference a Secret as an environment variable?

A

secret.env

B

envFrom

C

secretFrom

D

volumeMounts

Q51

Q51 How do you create a Secret with username and password from the CLI?

A

kubectl create secret generic

B

kubectl set secret

C

kubectl apply secret

D

kubectl create config

Q52

Q52 A pod fails to access a ConfigMap. What might be the issue?

A

Incorrect pod labels

B

Missing ConfigMap

C

Cluster is down

D

Incorrect image name

Q53

Q53 A pod cannot access a Secret mounted as a volume. What could be wrong?

A

Secret not found

B

Pod labels missing

C

Secret is corrupted

D

Incorrect kube-proxy config

Q54

Q54 A pod consumes a ConfigMap but the data is outdated. What could resolve this?

A

Restart the pod

B

Delete ConfigMap

C

Recreate pod

D

Manually update data

Q55

Q55 What is the purpose of PersistentVolume (PV) in Kubernetes?

A

To store pod logs

B

To provide persistent storage

C

To expose pods

D

To monitor clusters

Q56

Q56 What is the role of PersistentVolumeClaim (PVC)?

A

Request persistent storage

B

Bind pods to nodes

C

Manage storage classes

D

Expose data

Q57

Q57 What is a StorageClass in Kubernetes?

A

A type of PV

B

Defines storage policies

C

A pod specification

D

A cluster role

Q58

Q58 Which type of volume is suitable for temporary storage in Kubernetes?

A

PersistentVolume

B

ConfigMap

C

Secret

D

EmptyDir

Q59

Q59 What happens when a pod using an EmptyDir volume restarts?

A

Volume persists

B

Volume is deleted

C

Volume is re-created

D

Volume is inaccessible

Q60

Q60 Which field in a PVC spec is used to request storage size?

A

spec.storage

B

resources.requests.storage

C

spec.capacity

D

storage.resources

ad verticalad vertical
ad