<p>Currently, to update a k8s deployment image, we use the <code>kubectl set image</code> command like this:</p>

<pre><code>kubectl set image deployment/deployment_name container=url_to_container
</code></pre>

<p>While this command updates the URL used for the main container in the deployment, it does not update the URL for the <code>initContainer</code> also set within the deployment.</p>

<p>Is there a similar <code>kubectl</code> command I can use to update the <code>initContainer</code> to the same URL?</p>

<p>Since the accepted answer, the team <a href="https://github.com/kubernetes/kubernetes/pull/72276" rel="noreferrer">developed</a> the ability to set image for Kubernetes init containers. Using the same command, simply use the init container name for the container part of the command you supplied. </p>

<pre><code>kubectl set image deployment/deployment_name myInitContainer=url_to_container
</code></pre>

<p>In case you want to update both container images in a single command, use:</p>

<pre><code>kubectl set image deployment/deployment_name myInitContainer=url_to_container container=url_to_container
</code></pre>
