gpt4 book ai didi

kubernetes - configmap更改时, Helm chart 重新启动pod

转载 作者:行者123 更新时间:2023-12-03 23:46:31 26 4
gpt4 key购买 nike

当有confimap或 secret 更改时,我正在尝试重新启动容器。我已经尝试过与https://github.com/helm/helm/blob/master/docs/charts_tips_and_tricks.md#automatically-roll-deployments-when-configmaps-or-secrets-change中描述的代码相同的代码
但是,更新configmap后,我的pod不会重新启动。您知道这里可能做错了什么吗?

apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
{{- include "global_labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "app.name" . }}
release: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yml") . | sha256sum }}

最佳答案

Helm和Kubernetes均未提供针对ConfigMap更改的特定滚动更新。解决办法已经有一段时间了,只是对部署进行修补,从而触发滚动更新:

kubectl patch deployment your-deployment -n your-namespace -p '{"spec":{"template":{"metadata":{"annotations":{"date":"$(date)"}}}}}'

您可以看到状态:
kubectl rollout status deployment your-deployment

请注意,这在nix机器上有效。直到添加了 feature

关于kubernetes - configmap更改时, Helm chart 重新启动pod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52658839/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com