<p>I have simple issue with StatefulSet update on my dev environment and CI.</p>
<p>I want to replace all StatefulSet replicas instantly without using Kubectl delete first.
Is it possible to change the manifest to strategy: Replace as in Deployments and continue using kubectl apply ...</p>

mkasepuu
<p>Currently the <a href="https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/" rel="nofollow noreferrer">StatefulSets</a> support only two kinds of <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies" rel="nofollow noreferrer">update strategies</a>:</p>
<ul>
<li><p><code>RollingUpdate</code>: The <code>RollingUpdate</code> update strategy implements automated, rolling update for the Pods in a StatefulSet. It is the default strategy when <code>.spec.updateStrategy</code> is left unspecified. When a StatefulSet's <code>.spec.updateStrategy.type</code> is set to <code>RollingUpdate</code>, 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. It will wait until an updated Pod is Running and Ready prior to updating its predecessor.</p>
</li>
<li><p><code>OnDelete</code>: The <code>OnDelete</code> update strategy implements the legacy (1.6 and prior) behavior. When a StatefulSet's <code>.spec.updateStrategy.type</code> is set to <code>OnDelete</code>, the StatefulSet controller will not automatically update the Pods in a StatefulSet. Users must manually delete Pods to cause the controller to create new Pods that reflect modifications made to a StatefulSet's <code>.spec.template</code>.</p>
</li>
</ul>
<p>However, there is a plan to implement a <a href="https://github.com/kubernetes/kubernetes/issues/68397" rel="nofollow noreferrer">MaxUnavailable Rolling Update to StatefulSet</a>. It would allow you to update X number of replicas together based on a <code>maxUnavailble</code> strategy. It led to this <a href="https://github.com/kubernetes/enhancements/pull/1010" rel="nofollow noreferrer">update proposal</a> but it is not done yet and judging from the latest comments it should be set as a milestone for Kubernetes 1.20.</p>
