I am trying to do a rolling update of my stateful set by setting the updateStrategy
in the STS spec but it looks like on deleting the statefulset pod, it gets terminated and a new pod is coming up. So, question is I want to keep my existing pod running on deletion command from client and once the new pod is up and running my old one should be terminated. How can I achieve this with statefulset? Is it possible with statefulset like we do rolling updates in a deployment resource?
It is not possible to update statefulset like rolling updates in a deployments
, as mentioned in the doc:
When a StatefulSet's .spec.updateStrategy.type is set to RollingUpdate, the StatefulSet controller will delete and recreate each Pod in the StatefulSet. It will proceed in the same order as Pod termination (from the largest ordinal to the smallest), updating each Pod one at a time.
So you can use bluegreen deployment
or use the OnDelete update strategy
. This allows you to manually delete pods to trigger the StatefulSet controller
to create new pods with the updated template.
Here is the blog by Ajay explaining about it in a detailed version.