When issuing a helm upgrade on a running pod, my configmap is updated, but will the pod know about the configmap updated values automatically or is there another step that I need to take to inject new configmap values into the pod?
My overall goal is to avoid having to interact with the running pod such as a delete or restart / reinstall.
I've seen a lot of info about changing sha1sum and doing some workarounds, but my question is more basic - do pods automatically become aware of new configmap items?
---- UPDATE --- so what we ended up doing was:
helm upgrade -n release -f release/values.yaml --recreate-pods
although this terminates the existing pod, another one is instantly started upon issuing the command, meaning "near zero" downtime.
No, pods do not automatically become aware of the contents of a config map change.
In the case of a helm upgrade, that’s why you need to use helm template syntax to add the config map file’s hash value to the pod (or pod template) metadata. This creates a link between the config and pod.
If you do that, the pod (or pod template) is updated even if only the config map is changed. Then, no manual intervention is required.
If your Helm chart creates a ConfigMap, and that ConfigMap is mounted as a volume into a pod, then when the ConfigMap updates, the container filesystem also updates. It's then up to the application to notice that the files have changed.
Tricks like setting a hash of the file contents as a pod annotation are specifically there to cause a Deployment to update in a way that will delete and recreate existing Pods. This is okay! Pods in Kubernetes are very disposable, and if you delete a Pod managed by a Deployment it will get automatically recreated. If your application only reads the ConfigMap contents at startup time (this is very typical) then you need to do something like this to cause the Pod to restart on its own (copied out of the linked documentation):
kind: Deployment
spec:
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}