PersistentVolumeClaim won't bind to PersistentVolume

Solution Verified - Updated

Environment

  • OpenShift Container Platform 3.X

Issue

  • Metrics Storage Won't Mount
  • My PVC won't bind to my available PV
  • The metrics is failing to work because it can't bind the PVC to PV
  • I know my volume can mount to my hosts but I'm getting errors saying the PVC is not yet bound
  • Error syncing pod, skipping: failed to instantiate volume plugin for cassandra-data: The claim metrics-cassandra-1 is not yet bound to a volume

Resolution

  • Please check the storage and the AccessModes specified by the PersistentVolumeClaim and compare it to the storage and Accessmodes specified on the PersistentVolume.
# oc get pv,pvc
NAME               LABELS    CAPACITY   ACCESSMODES   STATUS      CLAIM                      REASON    AGE
metrics-storage    <none>    200Gi      RWX           Available                                        6d
registry-storage   <none>    1000Gi     RWO           Bound       default/registry-storage             14d
NAME                  LABELS                             STATUS    VOLUME    CAPACITY   ACCESSMODES   AGE
metrics-cassandra-1   metrics-infra=hawkular-cassandra   Pending                                      6d
# oc get pv/metrics-storage pvc/metrics-cassandra-1 -o yaml |grep -ie capacity -ie accessmodes -A7
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 200Gi
  nfs:
    path: /PATH/TO/THE/STORAGE
    server: hostname.of.server.com
--
accessModes:
    - ReadWriteOnce
    - ReadWriteMany
    resources:
      requests:
        storage: 100Gi
  status:
  • As you can see from the example above, the PVC is asking for two AccessModes (ReadWriteOnce AND ReadWriteMany) but the PV only has one AccessMode (ReadWriteMany)
    • To correct this binding issue, you will need to recreate the PersistentVolume with at least ReadWriteOnce AND ReadWriteMany AccessModes
  • An easy mistake to make is mismatching the storage units. For example, specifying capacity of 30G in the PVC and 30Gi in the PV would not allow the PV and PVC to bind since Gi units are larger than G. 30Gi = 32.2122G!

Root Cause

SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.