问题描述
我正在使用头盔图通过"ConfigMap"管理配置来部署Pod.
I am using helm charts to deploy pods with a "ConfigMap" managing the configurations.
我直接编辑ConfigMap以更改配置文件,然后使用kubectl delete删除pod,以使新配置生效.
I edit ConfigMap directly to make changes to configuration files and then delete pods using kubectl delete, for the new configuration to take effect.
是否有使用 helm 用新配置替换正在运行的pod的简便方法,而无需执行" kubectl delete "命令
Is there any easy way using helm to replace a running pod with the new configuration without executing "kubectl delete" command
推荐答案
我们发现,使用--recreate-pods
会立即终止该部署的所有正在运行的Pod,这意味着您的服务会停机.换句话说,您的广告连播不会进行滚动更新.
We have found that using --recreate-pods
will immediately terminate all running pods of that deployment, meaning some downtime for your service. In other words, there will be no rolling update of your pods.
在Helm中解决此问题的问题仍未解决: https://github.com/kubernetes /helm/issues/1702
The issue to address this in Helm is still open: https://github.com/kubernetes/helm/issues/1702
相反,掌舵人建议在批注中将配置文件的校验和添加到部署中.这样,部署将具有不同的哈希值,并且从本质上讲看起来是新手",从而导致其正确更新.
Instead helm suggests adding a checksum of your configuration files to the deployment in an annotation. That way the deployment will have a different hash and essentially look 'new' to helm, causing it to update correctly.
kind: Deployment
spec:
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
[...]
这篇关于在kubernetes掌舵上,如何用新的配置值替换pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!