How do I update kubernetes deployment image and command?

╄→гoц情女王★ 提交于 2020-07-31 03:12:30

问题


I see that I can use the "kubectl set image" command to update a container used in a deployment, like this:

kubectl set image deployment/myapp myapp=repo.mycompany.com/myapp/ui:beta.119

But, i would also like to use a different startup command in some situations. Is there a way to update both the image AND the command used for the container?


回答1:


You could use kubectl patch for that. Run kubectl patch --help to get the docs, but as far as I can tell something like this should do it:

$ kubectl patch deployment <your-deployment> -p '
spec:
  template:
    spec:
      containers:
        - name: <container-name>
          command: ["new", "command"]
' 


来源:https://stackoverflow.com/questions/55245930/how-do-i-update-kubernetes-deployment-image-and-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!