PVC in pending state for OpenShift 4
Environment
-
Red Hat OpenShift Container Platform (RHOCP)
- 4.x
-
AWS
Issue
-
When creating the PVC it gets in the
Pending
state and PVs are not created. -
Events message in the namespace shows:
waiting for a volume to be created, either by external provisioner "ebs.csi.aws.com" or manually created by system administrator
Resolution
- Remove the
selector
from the PVC definition.
Root Cause
- This error happens by design. Kubernetes documentation describes that when using
Dynamic Provision
for persistent volumes, it is not possible to useselector
in the PVC definition.
Note: Currently, a PVC with a non-empty selector can't have a PV dynamically provisioned for it.
Diagnostic Steps
- Inspect the logs from the controllers in namespace
openshift-cluster-csi-drivers
.
Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"myapp-project", Name:"mypvc", UID, APIVersion:"v1", ResourceVersion, FieldPath:""}): type: 'Normal' reason: 'Provisioning' External provisioner is provisioning volume for claim "myapp-project/mypvc"
Event(v1.ObjectReference{Kind:"PersistentVolumeClaim", Namespace:"myapp-project", Name:"mypvc", UID, APIVersion:"v1", ResourceVersion, FieldPath:""}): type: 'Warning' reason: 'ProvisioningFailed' failed to provision volume with StorageClass "gp2-csi": claim Selector is not supported
-
Verify that the
StorageClass
is using a Provisioner. -
If the
StorageClass
is usingvolumeBindingMode: WaitingForConsumer
, make sure that there is a pod/deployment definition specifying the PVC.
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.
Comments