<p>I am setting up an application in kubernetes and want to restart the pod if the new image is pushed into docker hub.
I am not able to restart the pod if the new image is pushed into docker hub registry?</p>
<p>I have included</p>
<blockquote>
<p>&quot;imagePullPolicy&quot;: &quot;Always&quot;</p>
<p>&quot;terminationGracePeriodSeconds&quot;: 30</p>
</blockquote>
<p>in deployment.yaml file</p>
<p>How to pull the new image to pod without stopping the existing pod?</p>

rakeshh92
<p>Even in plain Docker, you can never update a container to a newer image without deleting and recreating it.  This is also impossible in Kubernetes: the list of <code>containers</code> in a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#podspec-v1-core" rel="nofollow noreferrer">pod spec</a> “cannot currently be added or removed...cannot be updated”, which means you can never change the image on an existing Pod.</p>

<p>In Kubernetes, the best practice is to always use an explicit version tag (never <code>latest</code> or anything similar that’s expected to change) and to manage Pods with Deployments.  When you have a new build, change your Deployment spec to have the new tag.  Kubernetes will notice that the new Deployment is different from the old one, and will, in order:</p>

<ol>
<li>Start a new Pod with the new image;</li>
<li>Wait for its health checks to pass; and</li>
<li>Delete the old Pod.</li>
</ol>

<p>This results in a zero-downtime upgrade.</p>
