<p>In this stackoverflow question:  <a href="https://stackoverflow.com/questions/38261107/kubernetes-deployment-how-to-change-container-envi">kubernetes Deployment. how to change container environment variables for rolling updates?</a></p>

<p>The asker mentions mentions he edited the deployment to change the version to v2.  What's the workflow for automated deployments of a new version assuming the container v2 already exists?  How do you then deploy it without manually editing the deployment config or checking in a new version of the yaml?  </p>

<p>If you change the underlying container (like v1 -> another version also named v1) will Kubernetes deploy the new or the old?</p>

<p>If you don't want to:</p>

<ul>
<li>Checking in the new YAML version</li>
<li>Manually updating the config</li>
</ul>

<p>You can update the deployment either through:</p>

<ul>
<li>A REST call to the deployment in question by patching/putting your new image as a resource modification. i.e. <code>PUT /apis/extensions/v1beta1/namespaces/{namespace}/deployments -d {... deployment with v2...}</code></li>
<li><a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment" rel="nofollow noreferrer">Set the image</a> <code>kubectl set image deployment/&lt;DEPLOYMENT_NAME&gt; &lt;CONTAINER_NAME&gt;:&lt; IMAGE_NAME&gt;:v2</code></li>
</ul>
