<p>This is my storage class configuration </p>

<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
  name: gp2
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
  fsType: ext4
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
</code></pre>

<p>and the persistent volumes are created with AWS ebs.</p>

<p>While deployment the persistent volume claim is failed with the following error</p>

<pre><code>ProvisioningFailed     persistentvolumeclaim/storage-fabric-orderer0   Failed to provision volume with StorageClass "gp2": claim.Spec.Selector is not supported for dynamic provisioning on AWS
</code></pre>

<p>The provisioner is up and running in my cluster</p>

<pre><code>ebs-csi-controller-585596ff6f-2csq4       4/4     Running   0          16m
ebs-csi-controller-585596ff6f-pw9qt       4/4     Running   0          16m
ebs-csi-node-k85xf                        3/3     Running   0          16m
</code></pre>

<p><strong>Pv file</strong></p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: ec1-default-ics-dev-alz-fabric-bc-pvol-storage-uk-bcpeer
  labels: {"app.kubernetes.io/component":"fabric-bc","app.kubernetes.io/id":"uk-bcpeer","app.kubernetes.io/name":"ec1-default-ics-dev-alz-fabric-bc-pvol-storage-uk-bcpeer","app.kubernetes.io/type":"storage","fabric/organization":"org1","fabric/organization-name":"uk","failure-domain.beta.kubernetes.io/region":"eu-central-1","failure-domain.beta.kubernetes.io/zone":"eu-central-1a","replica-index":"0"}
spec:
  capacity:
    storage: 20Gi
  accessModes: 
    - ReadWriteOnce
  storageClassName: gp2
  awsElasticBlockStore:
    volumeID: vol-0b0e325a942392d7f
    fsType: ext4
</code></pre>

<p>PV claim</p>

<pre><code>---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ list "storage" . | include "fabric-orderer.pvc" }}
  labels:
    {{ include "fabric-orderer.labels" . | nindent 4 }}
spec:
  selector:
    matchLabels:
      app.kubernetes.io/component: {{ .Values.dlt.component }}
      type: storage
      fabric/organization: {{ .Values.dlt.organization }}
      replica-index: {{ .Values.dlt.organizationIndex | print | toJson }}
  storageClassName: "gp2"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: {{ .Values.persistentVolume.storageSize }}
</code></pre>

<p><code>spec.selector</code> should not be set in PVC yaml for dynamic provisioning in AWS because it's not supported. You need to remove this part from the PVC yaml.</p>

<pre><code>spec:
  selector:
    matchLabels:
      app.kubernetes.io/component: {{ .Values.dlt.component }}
      type: storage
      fabric/organization: {{ .Values.dlt.organization }}
      replica-index: {{ .Values.dlt.organizationIndex | print | toJson }}
</code></pre>

<p>From the  <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1" rel="nofollow noreferrer">docs</a>.</p>

<blockquote>
  <p>Note: Currently, a PVC with a non-empty selector can’t have a PV
  dynamically provisioned for it.</p>
</blockquote>
