W have a ConfigMap for our Gorush service (see the Kubernetes: running a push-server with Gorush behind an AWS LoadBalancer post).
The issue is that if change a value in this ConfigMap or Secrets -it will not be applied to already running pods.
There are various solitons like mount data as volumes and re-attach those volumes after data has been changed, or to create a brand new ConfigMap with a new name each time on a new change, and re-map it to the pods.
But let’s try to use the
Running Reloader in Kubernetes
Create a service and related objects – configs, roles, etc:
It will be deployed to the в default namespace, and by default will watch for all ConfigMap and Secrets in all namespaces, but you can limit this behavior using object’s annotations, see the full doc
Check the service’s pod:
Now, let’s check an existing value from the Gorush service:
And its ConfigMap:
--- apiVersion: v1 kind: ConfigMap metadata: name: gorush-config namespace: gorush data: # stat stat.engine: redis stat.redis.host: redis:6379 ios.enabled: "true" ios.key_path: /data/ssl/apns-crt.p12 ...
Update its deployment and add to the annotations one of the following string –
reloader.stakater.com/auto: "true" or
configmap.reloader.stakater.com/reload: "gorush-config", or you’d like to watch only this particular ConfigMap:
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: gorush namespace: gorush annotations: configmap.reloader.stakater.com/reload: "gorush-config" spec: replicas: 1 template: metadata: labels: app: gorush tier: frontend ...
Apply the deployment:
Add some changes to the Gorush’ cConfigMap, for example, let’s change
ios.enabled: "true" to the
And Gorush’ settings now: