intermediate
ConfigMap
Store non-secret configuration separately from images so workloads can be configured by environment.
A ConfigMap stores non-secret configuration separately from the image so the same artifact can run in different environments via env vars or mounted files.
apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
data:
LOG_LEVEL: info
FEATURE_BETA: "false"
---
envFrom:
- configMapRef:
name: api-config
Environment variables from ConfigMaps are snapshots at pod start. Mounted files can be updated, but apps must reload or pods must restart.
On interviews: reload behavior, env vs volume mounts, immutable ConfigMaps, and why secrets belong elsewhere.
Common pitfalls: expecting hot reload without app support; storing credentials in ConfigMaps.
The trade-off is simple config injection versus operational steps to roll out config changes.
Checklist:
- ConfigMaps only for non-secrets.
- Plan reload or controlled rollout.
- Version important config changes.
- Keep image environment-agnostic.