Example Documentation: ConfigMap Reload
Goal
Observe the difference between ConfigMap values as environment variables and mounted files.
What Is Done
A container reads ConfigMap content through an environment variable and through a file. The ConfigMap is patched afterwards.
Typical Commands
kubectl apply -f manifests/
kubectl logs -n config-reload-lab deploy/configmap-reload --tail=5
kubectl patch configmap app-config -n config-reload-lab --type=merge -p '{"data":{"APP_MODE":"patched","message":"file updated"}}'
Validate Success
- The mounted file changes after a short delay.
- The environment variable remains unchanged until the Pod restarts.
- Logs show both values side by side.
Common Mistakes
- An immediate file update is expected even though kubelet syncs with delay.
- Applications do not automatically reload changed files.
- ConfigMap updates are confused with Secret rotation.