Kubernetes MCQs – Configuration Management

In Kubernetes, managing configuration separately from application code is a critical practice that enables portability, flexibility, and scalability. Kubernetes provides powerful resources such as ConfigMaps and Secrets to inject configuration data into containers without hardcoding it into the application.

These resources support environment variables, volume mounts, and command-line arguments for dynamic configuration. Mastering configuration management is essential for deploying modern, secure, and maintainable applications in Kubernetes clusters.

1.) What is the purpose of a ConfigMap in Kubernetes?

A) Store logs
B) Store application secrets
C) Store non-confidential configuration data
D) Manage network policies

Answer: Option C

Explanation: ConfigMaps are used to decouple configuration artifacts from image content.

2.) Which Kubernetes object is used to store sensitive information like passwords and API keys?

A) ConfigMap
B) Secret
C) Volume
D) Service

Answer: Option B

Explanation: Secrets are designed for storing confidential data such as tokens, passwords, and certificates.

3.) How are ConfigMaps commonly injected into pods?

A) Only as environment variables
B) Only as files in a volume
C) As environment variables or mounted files
D) Only in YAML comments

Answer: Option C

Explanation: ConfigMaps can be exposed to containers either through environment variables or mounted as files.

4.) Which encoding is used by Kubernetes Secrets?

A) SHA256
B) MD5
C) Base64
D) Binary

Answer: Option C

Explanation: Secrets are stored as Base64-encoded strings for easy decoding and transport.

5.) Are Kubernetes Secrets encrypted by default at rest?

A) Yes
B) No
C) Only on Linux
D) Only in production

Answer: Option B

Explanation: Secrets are only Base64-encoded by default; encryption at rest must be explicitly configured.

6.) What is the maximum size for a ConfigMap or Secret key-value pair?

A) 1MB
B) 512KB
C) 256KB
D) 10MB

Answer: Option A

Explanation: The total size of a ConfigMap or Secret cannot exceed 1MB.

7.) Which command is used to create a ConfigMap from a file?

A) kubectl create file
B) kubectl create cm -f config.yaml
C) kubectl apply -c configmap.yaml
D) kubectl create configmap <name>–from-file=<file>

Answer: Option D

Explanation: This command allows creating a ConfigMap directly from a file.

8.) Which field in a Pod definition allows you to reference a Secret as an environment variable?

A) volumeMounts
B) envFrom
C) valueFrom.secretKeyRef
D) spec.secretEnv

Answer: Option C

Explanation: This field allows environment variables to reference values stored in Secrets.

9.) What happens if a pod tries to mount a non-existent ConfigMap?

A) The pod fails to start
B) The pod starts with empty values
C) Kubernetes creates the ConfigMap
D) It continues with a warning

Answer: Option A

Explanation: Kubernetes throws an error if the referenced ConfigMap doesn’t exist at pod startup.

10.) Which section in a deployment spec mounts a ConfigMap as a volume?

A) env
B) volumes
C) configRef
D) containers

Answer: Option B

Explanation: The volumes section is used to mount a ConfigMap into a pod as a file system volume.

Leave a Reply

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