This is my storage class configuration
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
and the persistent volumes are created with AWS ebs.
While deployment the persistent volume claim is failed with the following error
ProvisioningFailed persistentvolumeclaim/storage-fabric-orderer0 Failed to provision volume with StorageClass "gp2": claim.Spec.Selector is not supported for dynamic provisioning on AWS
The provisioner is up and running in my cluster
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
Pv file
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
PV claim
---
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 }}
spec.selector
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.
spec:
selector:
matchLabels:
app.kubernetes.io/component: {{ .Values.dlt.component }}
type: storage
fabric/organization: {{ .Values.dlt.organization }}
replica-index: {{ .Values.dlt.organizationIndex | print | toJson }}
From the docs.
Note: Currently, a PVC with a non-empty selector can’t have a PV dynamically provisioned for it.