Practical technology learning
Kubernetes ConfigMaps: Separate Environment Variables from Mounted Files
Changing a ConfigMap does not mean every running application immediately reads a new value. The delivery method and the application's own reading behaviour are separate parts of the configuration contract.
Begin with a paper-only fixture
Use a fictional non-sensitive setting such as banner_colour = blue. Sketch two otherwise identical practice workloads: one consumes the setting as an environment variable, and one reads a file from a ConfigMap volume. No live cluster, cloud account or rollout is required to write the comparison.
This exercise belongs beside configuration foundations in Kubernetes learning. Jaipur learners can use the worksheet to ask precise questions before attempting an authorised disposable-cluster lab.
Predict the environment-variable case
A running container's environment does not automatically refresh when its source ConfigMap changes. If the design needs a new value through that environment, plan replacement of the relevant Pods through an appropriate workload process. Updating the ConfigMap object alone does not change the existing process environment.
Predict the mounted-file case separately
For a regular ConfigMap volume projection, updated content is eventually reflected in the mounted files. The timing depends on kubelet synchronisation and propagation; do not promise an exact instant. A container that mounts a ConfigMap using subPath does not receive these updates in the same way.
A new file value is still different from a new application setting. An application that reads its configuration only once at startup may continue using the old in-memory value. It needs a suitable reload design or an appropriate restart strategy.
Add an application-level observation
For each delivery method, write where you would inspect the delivered value and where you would inspect the value actually used by the app. These can differ. A useful test record includes the object change, delivery observation, application observation and any deliberate workload replacement.
Use only dummy configuration. ConfigMaps are not intended to protect confidential data. Credential handling, authorisation and rollout safety need their own design and are outside this synthetic worksheet.
Keep the contract explicit
- Delivery: environment variable, ordinary mounted projection or subPath.
- Application reading: once at startup, periodic read or a deliberate watcher.
- Expected refresh behaviour and how it will be observed.
- Owner-approved procedure before any real workload change.
Explain the gap before operating
Save one sentence stating why an updated object is not proof of updated runtime behaviour. The related Mango Engineers Kubernetes course provides broader Pod, deployment and configuration foundations; confirm current prerequisites and syllabus before choosing a learning path.