<p>I'm hosting an application on the Google Cloud Platform via Kubernetes, and I've managed to set up this continuous deployment pipeline:</p>

<ol>
<li>Application code is updated</li>
<li>New Docker image is automatically generated</li>
<li>K8s Deployment is automatically updated to use the new image</li>
</ol>

<p>This works great, except for one issue - the deployment always seems to have only one pod. Because of this, when the next update cycle comes around, the entire application goes down, which is unacceptable. </p>

<p>I've tried modifying the YAML of the deployment to increase the number of replicas, and it works... until the next image update, where it gets reset back to one pod again. </p>

<p>This is the command I use to update the image deployment:</p>

<pre><code>set image deployment foo-server gcp-cd-foo-server-sha256=gcr.io/project-name/gcp-cd-foo-server:$REVISION_ID
</code></pre>

Artem Zakharov
<p>You can use this command if you dont want to edit deployment yaml file:</p>

<pre><code>kubectl scale deployment foo-server --replicas=2
</code></pre>

<p>Also, look at update strategy with maxUnavailable and maxsurge properties.</p>
