Getting error "failed to provision volume with StorageClass "<storage class name>": claim Selector is not supported" when trying to provision a volume using CSI driver.
search cancel

Getting error "failed to provision volume with StorageClass "<storage class name>": claim Selector is not supported" when trying to provision a volume using CSI driver.

book

Article ID: 377890

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service

Issue/Introduction

1. Trying to provision a volume using the VMware CSI driver results in the PVC getting stuck in "Pending" state.

2. You see the below events in the kubectl describe pvc -n <namespace> <pvc name> command output.

 Type     Reason                Age                   From                                                                                                 Message
  ----     ------                ----                  ----                                                                                                 -------
  Normal   Provisioning      csi.vsphere.vmware.com_vsphere-csi-controller-<ID>  External provisioner is provisioning volume for claim "<PVC name>"
  Warning  ProvisioningFailed      csi.vsphere.vmware.com_vsphere-csi-controller-<ID>  failed to provision volume with StorageClass "<storage-class-name>": claim Selector is not supported
  Normal   ExternalProvisioning    persistentvolume-controller   waiting for a volume to be created, either by external provisioner "csi.vsphere.vmware.com" or manually created by system administrator

3. The PVC yaml is configured to use "selectors" and the useDynamicProvisioning is set to false.

Environment

vSphere CSI Driver

VMware vCenter Server

Cause

1. If the yaml has useDynamicProvisioning set to false, it means that the PVC expects to bind to an existing PV. Therefore, the PVs' 'label' and 'value' fields have to match the 'label' and 'value' fields specified under the 'selector' inside the PVC yaml.

2. The PVC is using the 'selector' field to find an existing PV based on the label along with its value.

3. When storage class using the CSI driver is not able to filter and select a pre-existing PV based on the label info provided, the PVC is not able to provision a volume to the pod since it cannot locate a suitable PV.

Resolution

1. Use dynamic provisioning which allows the CSI driver to provision a new volume based on Storage Class Settings. For the same, set the 'useDynamicProvisioning' to true inside the PVC yaml.

2. If you want to keep the labels and do manual provisioning, ensure that the labels specified in the selector match the ones in the PV.