我有一个简单的 kubernetes 部署,其中包含 3 个 nginx 容器的副本。
这里的 Kubernetes 文档说:
注意:当且仅当 部署的容器模板(即 .spec.template(已更改,对于 示例,如果模板的标签或容器映像已更新。 其他更新(例如缩放部署(不会触发 推出。
但是,当我扩展部署时,它确实会触发推出。我在这里错过了什么?
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
是的,术语"推出"有些含糊不清,应该澄清一下,但这意味着当您更新容器模板时,会根据推出人体工程学来关闭现有容器并启动新容器。当您仅更改副本编号时,现有 Pod 将保留在原位,并与现有 Pod 相同的 Pod 将启动。因此,这就像添加到以前的推出中,而不是创建新的部署。