Kubernetes MCQs – Configuration Management

11.) Can a Secret be used in a volumeMounts section?

A) No
B) Yes
C) Only if encoded in JSON
D) Only if stored in a ConfigMap

Answer: Option B

Explanation: Secrets can be mounted as volumes and referenced in the volumeMounts section.

12.) Which key is mandatory in a ConfigMap YAML definition?

A) version
B) configKey
C) data
D) env

Answer: Option C

Explanation: The data field holds the actual configuration key-value pairs in a ConfigMap.

13.) What is the purpose of envFrom in a pod spec?

A) Import volume data
B) Import all environment variables from a ConfigMap or Secret
C) Restart container
D) Define service dependencies

Answer: Option B

Explanation: envFrom simplifies importing all key-value pairs as environment variables.

14.) How do you decode a Kubernetes Secret in Linux?

A) echo <value> | decode64
B) echo <value> | openssl
C) echo <value> | base64 –decode
D) kubectl decode

Answer: Option C

Explanation: Secrets are Base64 encoded and can be decoded using base64 –decode.

15.) Can you use binary data in Secrets?

A) No
B) Only in ConfigMaps
C) Only in JSON format
D) Yes, using binaryData

Answer: Option D

Explanation: Kubernetes supports binary data in Secrets using the binaryData field.

16.) What is the recommended way to store database credentials?

A) In the container image
B) In ConfigMaps
C) In Secrets
D) As labels

Answer: Option C

Explanation: Secrets provide secure handling for sensitive data such as credentials.

17.) What command lists all Secrets in a namespace?

A) kubectl get secrets
B) kubectl secrets list
C) kubectl get configmap
D) kubectl list secrets

Answer: Option A

Explanation: This command lists all Secrets in the current namespace.

18.) How do you create a Secret from literal values?

A) kubectl create secret text
B) kubectl create secret generic mysecret –from-literal=key=value
C) kubectl make secret
D) kubectl apply -s secret.yaml

Answer: Option B

Explanation: This creates a generic secret with inline values.

19.) What happens when a Secret is updated while the pod is running?

A) Pod restarts
B) Pod instantly picks up the change
C) Pod won’t see the change unless restarted (for env vars)
D) Node is tainted

Answer: Option C

Explanation: Environment variables from Secrets do not update live; a restart is needed.

20.) Can you reference a Secret in a Deployment spec?

A) No
B) Yes, via env or volume
C) Only in Pods
D) Only in StatefulSets

Answer: Option B

Explanation: Secrets can be referenced by Deployments for secure configuration.

Leave a Reply

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