<p>How can I speedup the rollout of new images in Kubernetes?</p>
<p>Currently, we have an automated build job that modifies a yaml file to point to a new revision and then runs <code>kubectl apply</code> on it.</p>
<p>It works, but it takes long delays (up to 20 minutes PER POD) before all pods with the previous revision are replaced with the latest.</p>
<p>Also, the deployment is configured for 3 replicas. We see one pod at a time is started with the new revision. (Is this the Kubernetes &quot;surge&quot; ?) But that is too slow, I would rather kill all 3 pods and have 3 new ones with the new image.</p>

<blockquote>
<p>I would rather kill all 3 pods and have 3 new ones with the new image.</p>
</blockquote>
<p>You can do that. Set <code>strategy.type:</code> to <code>Recreate</code> instead of the default <code>RollingUpdate</code> in your <code>Deployment</code>. See <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy" rel="nofollow noreferrer">strategy</a>.</p>
<p>But you probably get some downtime during deployment.</p>
