Restart pods when configmap updates in Kubernetes?

后端 未结 7 2112
猫巷女王i
猫巷女王i 2020-11-29 16:51

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


I know there\'s been talk about th

7条回答
  •  庸人自扰
    2020-11-29 17:12

    Signalling a pod on config map update is a feature in the works (https://github.com/kubernetes/kubernetes/issues/22368).

    You can always write a custom pid1 that notices the confimap has changed and restarts your app.

    You can also eg: mount the same config map in 2 containers, expose a http health check in the second container that fails if the hash of config map contents changes, and shove that as the liveness probe of the first container (because containers in a pod share the same network namespace). The kubelet will restart your first container for you when the probe fails.

    Of course if you don't care about which nodes the pods are on, you can simply delete them and the replication controller will "restart" them for you.

提交回复
热议问题