Kubernetes configmap更改不需要';t在各自的POD上自动反射
对于创建configmap,我使用以下命令:Kubernetes configmap更改不需要';t在各自的POD上自动反射,kubernetes,kubernetes-pod,Kubernetes,Kubernetes Pod,对于创建configmap,我使用以下命令: apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1 kind: Deployment metadata: name: consoleservice1 spec: selector: matchLabels: app: consoleservice1 replicas: 3 # t
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: consoleservice1
spec:
selector:
matchLabels:
app: consoleservice1
replicas: 3 # tells deployment to run 3 pods matching the template
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 5
template: # create pods using pod definition in this template
metadata:
labels:
app: consoleservice1
spec:
containers:
- name: consoleservice
image: chintamani/insightvu:ms-console1
readinessProbe:
httpGet:
path: /
port: 8385
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
ports:
- containerPort: 8384
imagePullPolicy: Always
volumeMounts:
- mountPath: /deploy/config
name: config
volumes:
- name: config
configMap:
name: console-config
在configmap中更改时,它不会自动反映,每次我都必须重新启动pod。我怎样才能自动完成它呢?谢谢你们。能够修复它,我正在使用重新加载程序来反映吊舱内部是否发生了任何变化 kubectl应用-f 然后在deployment.yml文件中添加注释
kubectl create configmap console-config --from-file=deploy/config
它将逐渐重新启动您的Pod。Pod和configmap在Kubernetes中是完全独立的,如果configmap发生更改,Pod不会自动重新启动 要做到这一点,几乎没有其他选择
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: consoleservice1
annotations:
configmap.reloader.stakater.com/reload: "console-config"
yq
将该值替换为configmap的哈希值,以防configmap中发生任何更改。Kubernetes将检测部署注释中的更改,并使用新配置重新加载吊舱apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: consoleservice1
annotations:
configmap.reloader.stakater.com/reload: "console-config"
yq w--inplace deployment.yaml spec.template.metadata.annotations.configHash$(kubectl get cm/configmap-oyaml | sha256sum)
参考资料:您好,当configmap中发生更改时,k8s不会触发新pod部署。下面是问题的详细信息,这里是该线程中的一些解决方案
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: application
spec:
selector:
matchLabels:
app: consoleservice1
replicas: 3
template:
metadata:
labels:
app: consoleservice1
annotations:
configHash: ""