<p>I'm having a Kubernetes deployment configured in <code>deployment.yaml</code> which is just 1 replica. The replica is running a container which running a process and it's <strong>very important</strong> to ensure there's no moment in time when there are two instances of this process are running.</p>
<p>The deployment / re-deployment is something I don't have control on and happens with <code>kubectl apply -f deployment.yaml</code> whenever there's a change to the spec.</p>
<p>This is not great, because k8s brings down a deployment <strong>only</strong> after the new one is up and running.</p>
<p>If I had control over how it's deployed, I would have executed <code>kubectl delete -f deployment.yaml</code> and then <code>kubectl apply -f deployment.yaml</code>. However, I don't have control over it.</p>
<p><strong>Question:</strong> how can I configure that in my deployment spec? i.e. to ensure there's no moment in time when there are two instances of the process running.</p>
<p>Thanks!</p>

SDE 888
<p>The default deployment strategy is rollingUpdate which brings your new pod up before the old pod goes down based on the values maxSurge and maxUnavailable.</p>
<p>Instead use recreate strategy. It will bring down the old pod, then bring up the new pod. You can configure this in your deployment.yaml file</p>
