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
Pendingstate and PVs are not created. -
Events in the project show messages similar to:
- waiting for a volume to be created, either by external provisioner "ebs.csi.aws.com" or manually created by system administrator
- failed to provision volume with StorageClass "gp2-csi": claim Selector is not supported
Resolution
- Remove the
selectorfrom the PVC definition.
Root Cause
- This error happens by design. Kubernetes documentation describes that when using
Dynamic Provisionfor persistent volumes, it is not possible to useselectorin 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
StorageClassis using a Provisioner. -
If the
StorageClassis 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