<p>The Kubernetes StatefulSet <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#rolling-updates" rel="nofollow noreferrer"><code>RollingUpdate</code> strategy</a> deletes and recreates each Pod in order. I am interested in updating a StatefulSet by recreating a pod <em>and then</em> deleting the old Pod (note the reversal), one-by-one.</p>
<p>This is interesting to me because:</p>
<ol>
<li>There is no reduction in the number of Ready Pods. I understand this is how a normal Deployment update works too (i.e. a Pod is only deleted after the new Pod replacing it is Ready).</li>
<li>More importantly, it allows me to perform application-specific live migration during my StatefulSet upgrade. I would like to &quot;migrate&quot; data from <code>(old) pod-i</code> to <code>(new) pod-i</code> before <code>(old) pod-i</code> is terminated (I would implement this in <code>(new) pod-i</code> readiness logic).</li>
</ol>
<p>Is such an update strategy possible?</p>

nurxg
<p>This is inherently possible with Deployments, but not StatefulSets. StatefulSets are used when you care strongly about an exact number of replicas with well known names. Deployments are used for more elastic workloads.</p>
<p>You may be able to accomplish your goal by using multiple StatefulSets- e.g. instead of a StatefulSet of 3 replicas, use 3 StatefulSets of 1 replica each. Then deploy an additional StatefulSet for your data migration before removing one of the previous ones.</p>
<p>Alternatively, this may be a use case for an <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/" rel="nofollow noreferrer">Operator</a> to manage the application.</p>
