<p>Is there any way to perform an update action on all pods simultaneously?</p>
<p>We have a process running in kubernetes as a stateful set where we want to update all the pods at the same time. We cannot seem to find a configuration for that. I am aware of <code>rollingUpdate</code>, which only updates one pod at a time.</p>
<p>This is what we have currently</p>
<pre><code>  updateStrategy:
    rollingUpdate:
      partition: 2
    type: RollingUpdate
</code></pre>
<p>I also tried with <code>maxUnavailable</code>, but still did not work.
Is there any other hack to get this done?</p>

CSUNNY
<p>There is no native alternative for updating all pods simultaneously when using Statefulsets.</p>
<p>The closest thing to it is to use the <a href="https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#parallel-pod-management" rel="nofollow noreferrer">Parallel Pod Management policy</a>, but it only affects the behavior for scaling operations (including initial setup) and doesn't work for updates.</p>
<hr />
<p>Although, the OpenKruise project has an extended component suite that enables <a href="https://openkruise.io/docs/next/user-manuals/advancedstatefulset/" rel="nofollow noreferrer">Advanced StatefulSet</a> to update workflow.</p>
<p>Here is a minimal working example that will <strong>upgrade all pods at once</strong>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps.kruise.io/v1beta1
kind: StatefulSet
metadata:
  name: sample
spec:
  replicas: 5
  serviceName: fake-service
  selector:
    matchLabels:
      app: sample
  template:
    metadata:
      labels:
        app: sample
    spec:
      readinessGates:
      - conditionType: InPlaceUpdateReady
      containers:
      - name: main
        image: nginx:alpine
  podManagementPolicy: Parallel
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 100%
</code></pre>
<p>Note this will <strong>certainly cause downtime</strong>, but you can adjust to something like <code>maxUnavailable: 50%</code> to make it more resilient.</p>
