For one of my containers inside a pod I set some of the environment variables using envFrom
:
envFrom:
- configMapRef:
name: my-config-map
Experimenting, it seems that updating the ConfigMap does not change the value of the corresponding environment value in the container.
Is there some way to force the update of the environment variable when setting them using configMapRef
? If not, where is this limitation explicitly documented?
The environment variables are set when the container is starting so there is no possible way to update those environment variables. You will need to restart Pod so it that reads again the ConfigMap values and sets the environment for the new created container.
You can do this automatically with some tools out there, like reloader, which will
watch changes in ConfigMap and Secrets and then restart pods for Deployment