<p>Why my pod error &quot;Back-off restarting failed container&quot; when I have <code>imagePullPolicy: &quot;Always&quot;</code>, Before It worked but today I deploy it on other machine, it show that error</p>
<h2>My Yaml:</h2>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: couchdb
  labels:
    app: couch
spec:
  replicas: 3
  serviceName: &quot;couch-service&quot;
  selector:
    matchLabels:
      app: couch
  template:
    metadata:
      labels:
        app: couch # pod label
    spec:
      containers:
      - name: couchdb
        image: couchdb:2.3.1
        imagePullPolicy: &quot;Always&quot;
        env:
        - name: NODE_NETBIOS_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NODENAME
          value: $(NODE_NETBIOS_NAME).couch-service # FQDN in vm.args
        - name: COUCHDB_USER
          value: admin
        - name: COUCHDB_PASSWORD
          value: admin
        - name: COUCHDB_SECRET
          value: b1709267
        - name: ERL_FLAGS
          value: &quot;-name couchdb@$(NODENAME)&quot;
        - name: ERL_FLAGS
          value: &quot;-setcookie b1709267&quot; #   the “password” used when nodes connect to each other.
        ports:
        - name: couchdb
          containerPort: 5984
        - name: epmd
          containerPort: 4369
        - containerPort: 9100
        volumeMounts:
          - name: couch-pvc
            mountPath: /opt/couchdb/data
  volumeClaimTemplates:
  - metadata:
      name: couch-pvc
    spec:
      accessModes: [&quot;ReadWriteOnce&quot;]
      resources:
        requests:
          storage: 10Gi
      selector:
        matchLabels:
          volume: couch-volume      
</code></pre>
<p>I describe it:</p>
<pre><code>Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  23s                default-scheduler  Successfully assigned default/couchdb-0 to b1709267node1
  Normal   Pulled     17s                kubelet            Successfully pulled image &quot;couchdb:2.3.1&quot; in 4.368553213s
  Normal   Pulling    16s (x2 over 22s)  kubelet            Pulling image &quot;couchdb:2.3.1&quot;
  Normal   Created    10s (x2 over 17s)  kubelet            Created container couchdb
  Normal   Started    10s (x2 over 17s)  kubelet            Started container couchdb
  Normal   Pulled     10s                kubelet            Successfully pulled image &quot;couchdb:2.3.1&quot; in 6.131837401s
  Warning  BackOff    8s (x2 over 9s)    kubelet            Back-off restarting failed container
</code></pre>
<p>What shound I do? Thanks</p>

cksawd
<p><code>ImagePullPolicy</code> doesn't really have much to do with container restarts. It only determines on what occasion should the image be pulled from the container registry, <a href="https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy" rel="nofollow noreferrer">read more here</a></p>
<p>If a container in a pod keeps restarting - it's usually because there is some error in the command that is the entrypoint of this container. There are 2 places where you should be able to find additional information that should point you to the solution:</p>
<ul>
<li>logs of the pod (check using <code>kubectl logs _YOUR_POD_NAME_</code> command)</li>
<li>description of the pod (check using <code>kubectl describe _YOUR_POD_NAME_</code> command)</li>
</ul>
