Restart pods when configmap updates in Kubernetes?

后端 未结 7 2098
猫巷女王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:14

    Had this problem where the Deployment was in a sub-chart and the values controlling it were in the parent chart's values file. This is what we used to trigger restart:

    spec:
      template:
        metadata:
          annotations:
            checksum/config: {{ tpl (toYaml .Values) . | sha256sum }}
    

    Obviously this will trigger restart on any value change but it works for our situation. What was originally in the child chart would only work if the config.yaml in the child chart itself changed:

        checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
    

提交回复
热议问题