Exercise 2: ConfigMap as Env Var vs. Mounted Volume — What Happens on a Change — Possible Solution ==================================================================== ENVIRONMENT VARIABLE consumption: per the chapter, env vars are "injected at container startup" and "a running pod does NOT pick up a later change, since env vars are only read once." This means if a ConfigMap's value is updated AFTER a pod is already running, that already-running pod continues operating with the OLD value it was given at startup -- indefinitely, until the pod is deleted and recreated (for example, via a new rollout, per Chapter 5's own material), at which point the freshly-created pod would read the NEW, current value at its own startup. MOUNTED VOLUME consumption: per the chapter, this "updates automatically (with some delay) if the underlying ConfigMap/Secret changes, without restarting the pod." This means an application reading its configuration from the FILE at the mount path can, if designed to periodically re-read that file, pick up the updated value WITHOUT the pod needing to be deleted or recreated at all -- the update propagates to the mounted file directly while the pod continues running. The practical consequence: if an application needs to respond to configuration changes live, without a restart, it needs to consume that configuration via a MOUNTED VOLUME and actively re-read the file periodically (env vars fundamentally cannot support this, since they're fixed at process startup by the operating system itself, not something Kubernetes can "push" an update into after the fact). If a restart-on-change is acceptable, or even desired as part of a deliberate redeploy process, env vars are simpler and fine to use. WHY THIS WORKS AS AN ANSWER ------------------------------ This directly contrasts the chapter's own two stated behaviors -- env vars fixed at startup vs. volume mounts updating live -- and explains the underlying REASON for the difference (env vars are an OS-level, startup-time mechanism; file contents can simply be overwritten on disk while a process keeps running), rather than just restating which one updates and which doesn't.