configmap更改不会自动反映在相应的Pod上 [英] configmap change doesn't reflect automatically on respective pods

查看:308
本文介绍了configmap更改不会自动反映在相应的Pod上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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:

For creating configmap I am using this command:

kubectl create configmap console-config --from-file=deploy/config

在configmap中进行更改时,每次我必须重新启动Pod时,它不会自动反映出来.我如何自动做到?

While changing in configmap it doesn't reflect automatically, every time I have to restart the pod. How can I do it automatically?

推荐答案

谢谢.能够修复它,如果内部进行了任何更改,我正在使用reloader反映在pod上 kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml

thank you guys .Able to fix it ,I am using reloader to reflect on pods if any changes done inside kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml

然后在您的deployment.yml文件中添加注释.

then add the annotation inside your deployment.yml file .

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"

它将逐渐重新启动您的广告连播.

It will restart your pods gradually .

这篇关于configmap更改不会自动反映在相应的Pod上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆