<p>How do I automatically restart Kubernetes pods and pods associated with deployments when their configmap is changed/updated?</p>

<hr>

<p>I know there's been talk about the ability to automatically restart pods when a config maps changes but to my knowledge this is not yet available in Kubernetes 1.2. </p>

<p>So what (I think) I'd like to do is a "rolling restart" of the <a href="http://kubernetes.io/docs/user-guide/deployments/" rel="noreferrer">deployment</a> resource associated with the pods consuming the config map. Is it possible, and if so how, to force a rolling restart of a deployment in Kubernetes without changing anything in the actual template? Is this currently the best way to do it or is there a better option?</p>

Johan
<p>The current best solution to this problem (referenced deep in <a href="https://github.com/kubernetes/kubernetes/issues/22368" rel="noreferrer">https://github.com/kubernetes/kubernetes/issues/22368</a> linked in the sibling answer) is to use Deployments, and consider your ConfigMaps to be immutable.</p>

<p>When you want to change your config, create a new ConfigMap with the changes you want to make, and point your deployment at the new ConfigMap. If the new config is broken, the Deployment will refuse to scale down your working ReplicaSet. If the new config works, then your old ReplicaSet will be scaled to 0 replicas and deleted, and new pods will be started with the new config.</p>

<p>Not quite as quick as just editing the ConfigMap in place, but much safer.</p>
