title: Minikube error states a bound pvc is not found
body: <p>When the resource file is applied the pod reports a persistentvolumeclaim &quot;pm-pv-claim&quot; not found. However, the pvc is present and bound. Why does the pod say it cannot find the pvc?</p>
  <p>Many forum posts suggest the issue relates to how Minikube handles storage, but solutions suggested there to explicitly declare the PV did not work for me. Other posts have the pvc and pv in unbound states, which does not apply here.</p>
  <p>Details:</p>
  <pre class="lang-yaml prettyprint-override"><code>cmdline ~&gt; kubectl describe pod pimgr-5df8f859d-z8xmz
  Name:         pimgr-5df8f859d-z8xmz
  Namespace:    default
  Priority:     0
  Node:         m01/192.168.99.10
  Start Time:   Sun, 30 Aug 2020 22:00:24 +0100
  Labels:       app=pimgr
                pod-template-hash=5df8f8569d
                tier=frontend
  Annotations:  &lt;none&gt;
  Status:       Running
  IP:           172.17.0.6
  IPs:
    IP:           172.17.0.6
  Controlled By:  ReplicaSet/pimgr-5df8f8569d
  Containers:
    pimgr:
      Container ID:   docker://5ca322e180283135d5b160a54ab0a46404381951d2b1ffa6c034df7c85f638
      Image:          pimgr/django:0.1
      Image ID:       docker://sha256:23abfa4de71126724c1fff6bda67ff8c093f903086718541be61f0be4097b3
      Port:           8010/TCP
      Host Port:      0/TCP
      State:          Terminated
        Reason:       Completed
        Exit Code:    0
        Started:      Sun, 30 Aug 2020 22:01:08 +0100
        Finished:     Sun, 30 Aug 2020 22:01:08 +0100
      Last State:     Terminated
        Reason:       Completed
        Exit Code:    0
        Started:      Sun, 30 Aug 2020 22:00:38 +0100
        Finished:     Sun, 30 Aug 2020 22:00:38 +0100
      Ready:          False
      Restart Count:  3
      Environment:    &lt;none&gt;
      Mounts:
        /code from pimgr-persistent-storage (rw)
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-llll4 (ro)
  Conditions:
    Type              Status
    Initialized       True 
    Ready             False 
    ContainersReady   False 
    PodScheduled      True 
  Volumes:
    pimgr-persistent-storage:
      Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
      ClaimName:  pm-pv-claim
      ReadOnly:   false
    default-token-llll4:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-llll4
      Optional:    false
  QoS Class:       BestEffort
  Node-Selectors:  &lt;none&gt;
  Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                   node.kubernetes.io/unreachable:NoExecute for 300s
  Events:
    Type     Reason            Age               From               Message
    ----     ------            ----              ----               -------
    Warning  FailedScheduling  &lt;unknown&gt;         default-scheduler  persistentvolumeclaim &quot;pm-pv-claim&quot; not found
    Warning  FailedScheduling  &lt;unknown&gt;         default-scheduler  error while running &quot;VolumeBinding&quot; filter plugin for pod &quot;pimgr-5df8f8569d-z8xmz&quot;: pod has unbound immediate PersistentVolumeClaims
    Warning  FailedScheduling  &lt;unknown&gt;         default-scheduler  error while running &quot;VolumeBinding&quot; filter plugin for pod &quot;pimgr-5df8f8569d-z8xmz&quot;: pod has unbound immediate PersistentVolumeClaims
    Normal   Scheduled         &lt;unknown&gt;         default-scheduler  Successfully assigned default/pimgr-5df8f8569d-z8xmz to m01
    Normal   Pulled            1s (x4 over 45s)  kubelet, m01       Container image &quot;pimgr/django:0.1&quot; already present on machine
    Normal   Created           1s (x4 over 45s)  kubelet, m01       Created container pimgr
    Normal   Started           1s (x4 over 45s)  kubelet, m01       Started container pimgr
    Warning  BackOff           0s (x5 over 43s)  kubelet, m01       Back-off restarting failed container
  </code></pre>
  <p><strong>resource.yaml</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
  kind: Service
  metadata:
    name: pimgr
    labels:
      app: pimgr
  spec:
    ports:
      - port: 8010
    selector:
      app: pimgr
      tier: frontend
    type: LoadBalancer
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: pm-pv-claim
    labels:
      app: pimgr
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 4Gi
  ---
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: pv0001
  spec:
    accessModes:
      - ReadWriteOnce
    capacity:
      storage: 5Gi
    hostPath:
      path: /data/pv0001/
    storageClassName: standard
  ---
  apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
  kind: Deployment
  metadata:
    name: pimgr
    labels:
      app: pimgr
  spec:
    selector:
      matchLabels:
        app: pimgr
        tier: frontend
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          app: pimgr
          tier: frontend
      spec:
        containers:
        - image: pimgr/django:0.1
          name: pimgr
          ports:
          - containerPort: 8010
            name: pimgr
          volumeMounts:
          - name: pimgr-persistent-storage
            mountPath: /code
        volumes:
        - name: pimgr-persistent-storage
          persistentVolumeClaim:
            claimName: pm-pv-claim
  </code></pre>
  <pre><code>cmdline ~&gt; kubectl get pods
  NAME                          READY   STATUS             RESTARTS   AGE
  pimgr-5df8f8569d-z8xmz        0/1     CrashLoopBackOff   2          36s
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>cmdline&gt; kubectl get pvc
  NAME                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
  pm-pv-claim         Bound    pv0001                                     5Gi        RWO            standard       20m
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>cmdline&gt; minikube version
  minikube version: v1.8.2
  commit: eb13446e786c9ef70cb0a9f85a633194e62396a1
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>cmdline ~&gt; kubectl get pv
  NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                       STORAGECLASS   REASON   AGE
  pv0001                                     5Gi        RWO            Retain           Bound    default/pm-pv-claim         standard                13h
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>cmdline &gt; minikube addons list
  |-----------------------------|----------|--------------|
  |         ADDON NAME          | PROFILE  |    STATUS    |
  |-----------------------------|----------|--------------|
  | dashboard                   | minikube | disabled     |
  | default-storageclass        | minikube | enabled ✅   |
  | efk                         | minikube | disabled     |
  | freshpod                    | minikube | disabled     |
  | gvisor                      | minikube | disabled     |
  | helm-tiller                 | minikube | disabled     |
  | ingress                     | minikube | disabled     |
  | ingress-dns                 | minikube | disabled     |
  | istio                       | minikube | disabled     |
  | istio-provisioner           | minikube | disabled     |
  | logviewer                   | minikube | disabled     |
  | metrics-server              | minikube | disabled     |
  | nvidia-driver-installer     | minikube | disabled     |
  | nvidia-gpu-device-plugin    | minikube | disabled     |
  | registry                    | minikube | disabled     |
  | registry-creds              | minikube | disabled     |
  | storage-provisioner         | minikube | enabled ✅   |
  | storage-provisioner-gluster | minikube | disabled     |
  |-----------------------------|----------|--------------|
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>cmdline &gt; kubectl get storageclass
  NAME                 PROVISIONER                RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
  standard (default)   k8s.io/minikube-hostpath   Delete          Immediate           false                  91d
  </code></pre>
  <p><strong>Update:</strong></p>
  <p>Its seems that the binding did succeed: I modified the spec/containers to:</p>
  <pre class="lang-sh prettyprint-override"><code>      containers:
        - image: pimgr/django:0.1
          name: pimgr
          command: [&quot;ls&quot;]
          args: [&quot;-l&quot;, &quot;/code1&quot;]
          ports:
          - containerPort: 8010
            name: pimgr
          volumeMounts:
          - name: pimgr-persistent-storage
            mountPath: /code1
  </code></pre>
  <p>and then added a file in the minikube vm by:</p>
  <pre class="lang-sh prettyprint-override"><code>$ sudo touch /data/pv0001/hi
  $ ls /data/pv0001/
  hi
  </code></pre>
  <p>after applying the resource I saw:</p>
  <pre class="lang-sh prettyprint-override"><code>cmdline ~&gt; kubectl get pods
  NAME                          READY   STATUS             RESTARTS   AGE
  pimgr-55696d6dc4-gz74c        0/1     Completed          0          4s
  cmdline ~&gt; kubectl logs pimgr-55696d6dc4-gz74c
  total 0
  -rw-r--r-- 1 root root 0 Aug 31 15:06 hi
  
  </code></pre>
  <p>However the not found error is still present:</p>
  <pre class="lang-sh prettyprint-override"><code>cmdline ~&gt; kubectl describe pod pimgr-55696d6dc4-gz74c
  Name:         pimgr-55696d6dc4-gz74c
  Namespace:    default
  Priority:     0
  Node:         m01/192.168.99.103
  Start Time:   Mon, 31 Aug 2020 16:11:38 +0100
  Labels:       app=pimgr
                pod-template-hash=55696d6dc4
                tier=frontend
  Annotations:  &lt;none&gt;
  Status:       Running
  IP:           172.17.0.6
  IPs:
    IP:           172.17.0.6
  Controlled By:  ReplicaSet/pimgr-55696d6dc4
  Containers:
    pimgr:
      Container ID:  docker://4f4ceb807eb4d97e69a6af2da853561ca6c82006de545c68b7d2013da2aacc21
      Image:         pimgr/django:0.1
      Image ID:      docker://sha256:23abfa4de71126724c1fff6bda67ff8c093f903086718541be61f0be4097b3ee
      Port:          8010/TCP
      Host Port:     0/TCP
      Command:
        ls
      Args:
        -l
        /code1
      State:          Waiting
        Reason:       CrashLoopBackOff
      Last State:     Terminated
        Reason:       Completed
        Exit Code:    0
        Started:      Mon, 31 Aug 2020 16:11:52 +0100
        Finished:     Mon, 31 Aug 2020 16:11:52 +0100
      Ready:          False
      Restart Count:  2
      Environment:    &lt;none&gt;
      Mounts:
        /code1 from pimgr-persistent-storage (rw)
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-llll4 (ro)
  Conditions:
    Type              Status
    Initialized       True 
    Ready             False 
    ContainersReady   False 
    PodScheduled      True 
  Volumes:
    pimgr-persistent-storage:
      Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
      ClaimName:  pm-pv-claim
      ReadOnly:   false
    default-token-llll4:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-llll4
      Optional:    false
  QoS Class:       BestEffort
  Node-Selectors:  &lt;none&gt;
  Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                   node.kubernetes.io/unreachable:NoExecute for 300s
  Events:
    Type     Reason            Age                From               Message
    ----     ------            ----               ----               -------
    Warning  FailedScheduling  34s (x2 over 34s)  default-scheduler  persistentvolumeclaim &quot;pm-pv-claim&quot; not found
    Normal   Scheduled         32s                default-scheduler  Successfully assigned default/pimgr-55696d6dc4-gz74c to m01
    Normal   Pulled            18s (x3 over 31s)  kubelet, m01       Container image &quot;pimgr/django:0.1&quot; already present on machine
    Normal   Created           18s (x3 over 31s)  kubelet, m01       Created container pimgr
    Normal   Started           18s (x3 over 31s)  kubelet, m01       Started container pimgr
    Warning  BackOff           6s (x4 over 29s)   kubelet, m01       Back-off restarting failed container
  </code></pre>
  <p>So it appears to have correctly bound, but my original question still stands, why is it reporting that it was not found? Is this a red-herring or an issue elsewhere?</p>