PersistentVolumeClaim won't bind to PersistentVolume
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
30Gin the PVC and30Giin the PV would not allow the PV and PVC to bind sinceGiunits are larger thanG.30Gi = 32.2122G!
Root Cause
- For a PersistentVolumeClaim to bind to a PersistentVolume, it must find a volume that has at least the storage requested and at least the AccessModes requested.
- This page is not included, but the link has been rewritten to point to the nearest parent document.AccessModes are currently not enforced by OpenShift and are only used for this purpose of selecting the correct PersistentVolume.
- This page is not included, but the link has been rewritten to point to the nearest parent document.The Storage, or capacity, is much the same way. It is not enforced by OpenShift and is only used to helped select the correct PersistentVolume.
- If the PVC is not binding and there is an available PV, there is a good chance that the PV either:
- has less storage specified
-- The PV can have more storage specified and it can have the same amount but it can never have less - has fewer AccessModes specified
-- The PV can have more AccessModes specified and it can have the same AccessModes but it can never have fewer. - has different storageclasses
-- The PV can have a different storageclass than that of PVC and vice versa.
- has less storage specified
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.