is there any way to batch restart deployment to apply config change in kubernetes v1.15.2

4/29/2020

I an changed my kubernetes cluster(v1.15.2) configmap, now I want to make my config apply to all of my deployment in some namespace. What is the best practice to do? I am tried to do like this:

kubectl rollout restart deployment soa-report-consumer

but my cluster has so many deployment, should I write shell script to complete this task, any simple way?

-- Dolphin
kubernetes

2 Answers

4/29/2020

The usual fix for this is to use some automation from a tool like Kustomize or Helm so that the deployments automatically update when the config data changes.

-- coderanger
Source: StackOverflow

4/29/2020

ConfigMap Generator of kustomize can be used for this.

configMapGenerator contains a list of ConfigMaps to generate. By default, generated ConfigMaps will have a hash appended to the name. The ConfigMap hash is appended after a nameSuffix, if one is specified. Changes to ConfigMap data will cause a ConfigMap with a new name to be generated, triggering a rolling update to Workloads referencing the ConfigMap.

https://github.com/kubernetes-sigs/kustomize/blob/master/examples/configGeneration.md

-- Arghya Sadhu
Source: StackOverflow