You need to mount a ConfigMap as a volume in a Pod. Which field should you configure?
- spec.env.configMapKeyRef
- spec.volumes with configMap source ✓
- spec.configMapRef
- spec.containers[].volumeMounts
Correct answer: spec.volumes with configMap source
Option B is correct because to mount a ConfigMap as a volume you must declare the volume in spec.volumes using a configMap source entry, and then reference that volume by name in spec.containers[].volumeMounts; both fields are required together, but the configMap source belongs under spec.volumes. Option A is incorrect because spec.env with configMapKeyRef injects ConfigMap data as individual environment variables, not as a mounted volume. Option C is incorrect because spec.configMapRef is not a valid Pod spec field; the environment-variable approach uses envFrom with configMapRef under a container, not at the spec level. Option D is incorrect because spec.containers[].volumeMounts specifies where inside the container to mount a volume that has already been declared in spec.volumes, so it is necessary but not sufficient on its own to reference the ConfigMap.
Topic: · kubernetes, configmap, volumes, ckad