<p>Kubernetes only seems to pull images when the pod is created, how can I make it re-pull the latest image when the container itself exits?</p>
<p>I'd want the same effect as <code>kubectl rollout restart deployment</code>, but when the container exits. For example, if the container is a shell script, and it does <code>exit 1</code>, Kubernetes should pull the latest image from registry before restarting.</p>
<p>My deployment has only 1 container if that matters.</p>

throwaway91234
<p>You can use <code>imagePullPolicy</code>, read more over <a href="https://kubernetes.io/docs/concepts/containers/images/#updating-images" rel="nofollow noreferrer">here</a>.</p>
<p>Below is an example for your handy reference:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: pod-nginx-container-image-repull
spec:
  containers:
  - name: nginx-alpine-container-1
    image: nginx:alpine
    ports:
      - containerPort: 80
    imagePullPolicy: Always
</code></pre>
<hr />
<p><strong>UPDATE 1:</strong></p>
<p>When you use <code>restartPolicy: Never</code> then it means that you are telling Kubernetes that I do not want my container to restart in case it crashes. So, you are experiencing that there is no image re-pull in case container &quot;restart&quot; because there was actually no container restart.</p>
<p>I had quickly copied an example from my workspace so you saw <code>restartPolicy: Never</code> in my example which was not meant for you, I have updated my above example to remove it. But I hope you have understood one more concept with it.</p>
<p>Another thing worth noting is that <code>restartPolicy</code> applies to all containers in a Pod while <code>imagePullPolicy</code> can set at container level in Pod.</p>
