Senior
Is it possible to perform a sequential update of Pods in Deployment like in StatefulSet?
sobes.tech AI
Answer from AI
By default, in Deployment, Pod updates occur in parallel with the control of the maximum number of simultaneously updating and available Pods through the parameters maxUnavailable and maxSurge. Sequential updating, as in StatefulSet (where Pods are updated one by one in index order), is not directly supported in Deployment.
If a strict sequential replacement of Pods is needed, you can:
- Use StatefulSet instead of Deployment.
- Implement custom update logic outside Kubernetes.
- Configure
maxUnavailable: 1andmaxSurge: 0in the Deployment update strategies to update one Pod at a time, but the order is not guaranteed.
Example of configuring an update for one Pod at a time:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 0
However, this does not guarantee the sequential update of Pods by index, as in StatefulSet.