One minute
Automatic Service Reload after Configmap change
If you use tools such as Argo CD for your deployment, then it is always ensured that the latest version of the deployment is available in the cluster. But unfortunately, Argo CD (see also issue tracker) does not (and most likely will never) provide the option of restarting the corresponding deployment/service/POD when updating a configMap.
This is where additional tools such as stakater/Reloader comes into play.
Installation
First, the corresponding helmet repo must be integrated and updated
helmet repo add stakater https://stakater.github.io/stakater-charts && helmet repo update
The installation via Helm is very simple and usually requires no additional configuration, but if you are still interested in the options of the chart, you can save them with helm show values stakater/reloader > values-default.yaml
.
It has proven to be good practice to operate services like this in a dedicated namespace. Therefore, you should first create a namespace such as reloader kubectl create namespace reloader
.
The actual installation is done with the following one-liner
helm upgrade --install reloader stakater/reloader --namespace reloader
Usage
To restart a deployment foo-deployment whenever the configMap foo-config changes, the deployment of foo-deployment must be extended as follows:
metadata:
annotations:
configmap.reloader.stakater.com/reload: "foo-config"