PVC has non-bound phase ("Pending")

8/1/2019

So i'm deploying two PVC and one POD which references them When I try to create them, the PVC's get created with Pending state. The Pod exits immediately once these errors happen:

Error processing volume "data" for pod "storage-0-2_test(74facf84-b8ef-4d62-b001-3f1d9f000291)": 
error processing PVC "test"/"data-storage-0-2": PVC test/data-storage-0-2 has non-bound phase ("Pending") or empty pvc.Spec.VolumeName ("")

Relevant parts of the yaml are listed below:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: logs-storage-0-2
  namespace: test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: local-storage
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-storage-0-2
  namespace: test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 15Gi
  storageClassName: local-storage
---
apiVersion: v1
kind: Pod
metadata:
  labels:
  name: storage-0-2
  namespace: test
spec:
...
  containers:
  - env:
...  
    volumeMounts:
...
    - mountPath: /var/opt/hdfs/datanode
      name: data
      subPath: datanode
    - mountPath: /var/log
      name: logs
      subPath: hadoop
...
  volumes:
  - name: data
    persistentVolumeClaim:
      claimName: data-storage-0-2
  - name: logs
    persistentVolumeClaim:
      claimName: logs-storage-0-2
...

I do have PersistentVolumes of required sizes available in this namespace

-- Jeff Saremi
kubernetes

1 Answer

8/6/2019

I see two things that can be done here:

  1. Check if your storage class is in healthy state and make sure it is the default storage class. Also check if you can manually create a PersistentVolume and connect it without issues.

  2. If above is not the case than there might be something that already takes your PV or it is not being freed properly. A workaround in that case would be to just create extra PVs and see if that solves the problem.

Please let me know if that helped.

-- OhHiMark
Source: StackOverflow