Doc clarification: updating a deployment

Hello, I’ve found something in the documentation which I’d like to understand.

As I understand it: if you change the the “replicas” value on a deployment it automatically creates new containers or drops old containers as required. There is an example of this at Run a Stateless Application Using a Deployment - Kubernetes where increasing the replica count creates new pods.

However at Deployments - Kubernetes it 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.

This suggests the opposite.

Perhaps I don’t fully understand what’s meant by “trigger a rollout” in this context. Is a “rollout” only when all the old containers are replaced by fresh ones?

Many thanks,

Brian.

Hi Brian,

Changing the number of replicas should update the replicaset which then causes new containers to be created or existing to be deleted depending on scale up or scale down.

If you change an actual pod spec for the deployment, it will create an entirely new replicaset with the new pod spec which will cause new pods to spinnup and then once they are ready it will delete the old replicaset thus deleting the old pods.

So changing the count only creates or deletes pods.
Changing the pod spec creates brand new pods that match the new template and deletes all the old pods.

I don’t know if my explanation made things better or worse :laughing:

Kind regards,
Stephen