<p>I have a <code>kubernetes</code> cluster working perfectly fine. I have 10 worker nodes and 1 master device. I have a below <code>deployment.yaml</code> file type as <code>DaemonSet</code> for pods and containers.</p>

<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: deployment    
  namespace: mynamespace   

spec:
  replicas: 2
  selector:
    matchLabels:
      name: deployment
  template:
    metadata:
      labels:
        name: deployment

    spec:
      #List of all the containers
      containers:
      - name: container1
        image: CRname/container1
        imagePullPolicy: Always
        volumeMounts:
        - mountPath: /share
          name: share-files
        securityContext:
          privileged: true

      - name: container2
        image: CRname/container2
        imagePullPolicy: Always
        volumeMounts:
        - mountPath: /share
          name: share-files
        securityContext:  
          privileged: true

      volumes:
      - name: share-files
        hostPath:
          path: /home/user/shared-folder

      imagePullSecrets:
      - name: Mysecret

      nodeSelector:
         NodeType: ALL
</code></pre>

<p>On starting above, these two containers start running on all the worker nodes and runs perfectly fine. But I have observed that sometimes, few nodes show error as <code>ImagePullBackOff</code> which means that due to some network or any other issues, it wasn't able to download the image. I did use <code>describe</code> command to check which image failed. But the problem is it didn't try to automatically redownload the image. I had to delete the pod and thus it is automatically created and then it works fine. </p>

<p>I just want to know why the pod shows this error and do not try to redownload the image. Is there anything which I can add in the <code>yaml</code> file so that it delete and recreate the pod automatically on any type of error.</p>

<p><strong>EDIT</strong> I would also like to ask when the deployment is created, node starts to pull the image from the container registry initially for the first time. Once they are downloaded locally on the nodes, why does it has to pull the image again when the image is locally present.?</p>

<p>Please suggest some good options. Thanks.</p>

S Andrew
<p><code>imagePullPolicy: Always</code> cause you  download the image everytime pod restart. </p>

<p>And the pod is always restarted by daemonset, so just wait a bit more time. </p>
