2

I have a simple kubernetes deployment with 3 replicas of an nginx container.

The Kubernetes documentation here says:

Note: A Deployment’s rollout is triggered if and only if the Deployment’s pod template (that is, .spec.template) is changed, for example if the labels or container images of the template are updated. Other updates, such as scaling the Deployment, do not trigger a rollout.

However when I scale my deployment, it does trigger a rollout. What am I missing here?:

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
mumshad
  • 349
  • 4
  • 12

1 Answers1

0

Yeah, the term rollout is somewhat ambiguous and should be clarified, but it means that when you update the pod template, the existing pods are brought down and new pods are brought up, in accordance with the rollout ergonomics. When you just change the replica number, the existing pods are left in place and identical ones to the existing are spun up. So it's like adding to the previous rollout, not creating a new one.

Jonah Benton
  • 3,188
  • 1
  • 11
  • 26