<p>I followed the tutorial here <a href="https://cloud.google.com/python/django/container-engine#initialize_your_cloud_sql_instance" rel="nofollow noreferrer">https://cloud.google.com/python/django/container-engine#initialize_your_cloud_sql_instance</a></p>

<p>I have successfully deployed my service but the tutorial stops before getting to updating the deployment.</p>

<p>What I've tried to do is this. But it doesn't seem to actually update the pods or deploy the code. </p>

<pre><code>docker build -t gcr.io/&lt;my-app&gt;/polls .
gcloud docker -- push gcr.io/&lt;my-app&gt;/polls
kubectl apply -f polls.yaml
</code></pre>

<p>See the note and example in the docs about <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment" rel="nofollow noreferrer">updating a Deployment</a>:</p>

<blockquote>
  <p><strong>Note:</strong> A Deployment’s rollout is triggered if and only if the Deployment’s pod template (that is, .spec.template) is changed, for example if the labels or container images of the template are updated.</p>
</blockquote>

<p>Even though you have pushed a new image version the template itself is unchanged; the template still refers to the image as <code>gcr.io/&lt;my-app&gt;/polls</code> or <code>gcr.io/&lt;my-app&gt;/polls:latest</code>. And although the meaning of that is changed the <em>string itself</em> is unchanged.</p>

<p>To trigger an update push a new tag, say <code>gcr.io/&lt;my-app&gt;/polls:v2</code>, edit the yaml file and execute <code>kubectl apply -f polls.yaml</code>.</p>

<p>You can also use <code>kubectl set image</code> to trigger an update without changing the Deployment yaml file (<a href="https://asciinema.org/a/132998" rel="nofollow noreferrer">demo</a>); the same rule applies, the string identifying the image must change from what is deployed at the moment.</p>

<p>If you don't want create image tags you can also use the <code>sha256sum</code> of your new image (the value is displayed when you push the image); works in the yaml file too:</p>

<pre><code>kubectl set image deploy/mydeployment mycontainer=gcr.io/&lt;my-app&gt;/polls@sha256:2aac5e7514fbc77125bd315abe9e7b0257db05fe498af01a58e239ebaccf82a8
</code></pre>

<p>The discussion about this inconvenience is in <a href="https://github.com/kubernetes/kubernetes/issues/33664" rel="nofollow noreferrer">issue #33664</a> if you are interested in other ideas.</p>
