如何更新kubernetes部署映像和命令? [英] How do I update kubernetes deployment image and command?

查看:96
本文介绍了如何更新kubernetes部署映像和命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到我可以使用 kubectl set image命令来更新部署中使用的容器,例如:

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?

推荐答案

您可以使用 kubectl补丁。运行 kubectl patch --help 来获取文档,但据我所知,应该这样做:

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"]
' 

这篇关于如何更新kubernetes部署映像和命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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