2

我有一个简单的 kubernetes 部署,其中包含 3 个 nginx 容器副本。

这里的 Kubernetes 文档说:

注意:当且仅当 Deployment 的 pod 模板(即 .spec.template)发生更改时才会触发 Deployment 的推出,例如,如果模板的标签或容器图像被更新。其他更新(例如扩展部署)不会触发部署。

但是,当我扩展我的部署时,它确实会触发部署。我在这里想念什么?:

C:\Kubernetes>kubectl scale deployment myapp-deployment --replicas=20
deployment "myapp-deployment" scaled

C:\Kubernetes>kubectl rollout status deployment/myapp-deployment
Waiting for rollout to finish: 3 of 20 updated replicas are available...
Waiting for rollout to finish: 4 of 20 updated replicas are available...
Waiting for rollout to finish: 5 of 20 updated replicas are available...
Waiting for rollout to finish: 6 of 20 updated replicas are available...
Waiting for rollout to finish: 7 of 20 updated replicas are available...
Waiting for rollout to finish: 8 of 20 updated replicas are available...
Waiting for rollout to finish: 9 of 20 updated replicas are available...
Waiting for rollout to finish: 10 of 20 updated replicas are available...
Waiting for rollout to finish: 11 of 20 updated replicas are available...
Waiting for rollout to finish: 12 of 20 updated replicas are available...
Waiting for rollout to finish: 13 of 20 updated replicas are available...
Waiting for rollout to finish: 14 of 20 updated replicas are available...
Waiting for rollout to finish: 15 of 20 updated replicas are available...
Waiting for rollout to finish: 16 of 20 updated replicas are available...
Waiting for rollout to finish: 17 of 20 updated replicas are available...
Waiting for rollout to finish: 18 of 20 updated replicas are available...
Waiting for rollout to finish: 19 of 20 updated replicas are available...
deployment "myapp-deployment" successfully rolled out
4

1 回答 1

0

是的,推出这个术语有点含糊,应该澄清一下,但这意味着当你更新 pod 模板时,现有的 pod 会被放下,新的 pod 会根据推出的人机工程学原理出现。当您只更改副本编号时,现有的 pod 会留在原处,并且与现有的相同的 pod 会旋转起来。所以这就像添加到以前的推出,而不是创建一个新的。

于 2018-03-03T12:54:52.493 回答