What is a ConfigMap and when would you use it over an environment variable?
A ConfigMap stores non-sensitive configuration data as key-value pairs. It decouples your configuration from your container image.
Use ConfigMaps over hardcoded env vars when:
- Config needs to differ between environments (dev/staging/prod)
- Multiple pods share the same configuration
- You need to mount config as a file (e.g., nginx.conf, prometheus.yml)
For sensitive data like passwords, use a Secret instead of a ConfigMap.