更新部署,需要更改多个值

updating the deployment, need to change multiple values

我正在尝试使用

自动更新部署
kubectl set

我使用 kubectl set image 命令推送新版本的 docker 镜像没有问题,但我还需要添加一个新的永久磁盘供新镜像使用。我不相信我可以使用 set 命令设置 2 个不同的选项。这样做的最佳选择是什么?

http://kubernetes.io/docs/user-guide/managing-deployments/#in-place-updates-of-resources 有不同的选择。


您可以使用kubectl apply一次修改多个字段。

Apply a configuration to a resource by filename or stdin. This resource will be created if it doesn’t exist yet. To use ‘apply’, always create the resource initially with either ‘apply’ or ‘create –save-config’. JSON and YAML formats are accepted.

或者,可以使用 kubectl patch

Update field(s) of a resource using strategic merge patch JSON and YAML formats are accepted.