Two ways to consume a ConfigMap in a Pod
WHAT IT TESTS: ConfigMap consumption patterns. OUTLINE: Inject keys as environment variables (good for a few simple settings), or mount the ConfigMap as a volume of files (good for config files and live updates).
WHAT IT TESTS: Whether you know both injection methods and their trade-offs. ANSWER OUTLINE: First, expose ConfigMap entries as environment variables (via valueFrom/configMapKeyRef or envFrom), ideal for a handful of simple scalar settings like LOG_LEVEL. Second, mount the ConfigMap as a volume so each key becomes a file in a directory, ideal for whole config files (nginx.conf) and for picking up updates, since mounted ConfigMaps refresh without a Pod restart while env vars are fixed at start.
Read the original → interview
- #kubernetes
- #configmap
- #environment-variables
- #volumes
- #configuration
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.