I had a quick question about rolling deploys. I'm trying to make sure that the app pods creation is staggered. I looked at maxSurge
and maxUnavailable
which seems to be the only settings for controlling rolling deploys. Both these settings talk about pod creation in terms of old replicaset. I want to make sure that pod creation is staggered even when there is no deployment currently running.
example: If I set maxSurge
to 1 and I have the replication set to 5 then in the presence of old deployment, the rolling update strategy will do the right thing and get one pod up at a time, but if there is no old deployment, all the 5 pods will come up together on a new deployment which is something I am trying to avoid.
What you have explaied is the ecpected behaviour in case there are no existing deployments. So you want to do a ordered deployment - one pod after the other.
Try deploying the application as a statefulset. https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
Also note the differences b/w a deployment and a statefulset, for example no rollback in case of statefulset https://blog.thecodeteam.com/2017/08/16/technical-dive-statefulsets-deployments-kubernetes/