David M. Karr (83) [Avatar] Offline
In section "11.1.6. Introducing the controllers running in the Controller Manager ", I found the following sentence:

The Deployment controller performs a rollout of a new version each time a Deployment object is modified (if the modification should affect the deployed pods). It does this by creating a ReplicaSet and then appropriately scaling both the old and the new ReplicaSet based...

Is this true? If this is not a misstatement, what would it change in the old ReplicaSet?
Marko Lukša (67) [Avatar] Offline
It scales down the old ReplicaSet, while scaling up the new one. Depending on the update strategy, this process is performed like this:
- Rolling update strategy: increase the desired replica count in the new RS by e.g. 1, then decrease replica count on old RS by 1, then again increase new the new RS count by 1, and so on, until the old RS reaches zero.
- Replace strategy: set desired replica count on old RS to zero, then set replica count on new RS to replica count set on the Deployment object

The Deployment controller code that does the rolling update is here: https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/rolling.go
David M. Karr (83) [Avatar] Offline
Ah, right. The deployment is a stepwise transition from old to new.