I am trying to deploy a statefulSet that will use static volume provisioning (claim existing PVs) based on their label. However, it seems that the persistentvolume-controller is trying to provision storage dynamically, as when I kubectl desribe pvc db-data-db-N
the Events log states that:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning ProvisioningFailed 9s (x3 over 21s) persistentvolume-controller Failed to provision volume with StorageClass "db-data-storage": claim.Spec.Selector is not supported for dynamic provisioning on AWS
I have pre-provisioned PVs with this format (I am using Helm):
kind: PersistentVolume
apiVersion: v1
metadata:
name: db-data-{{ $volIndex }}
labels:
restoredFromBackup: "true"
spec:
capacity:
storage: 30Gi
accessModes:
- ReadWriteOnce
awsElasticBlockStore:
volumeID: {{ $volId }}
fsType: ext4
Here is my PVC template:
volumeClaimTemplates:
- metadata:
name: db-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 30Gi
selector:
matchLabels:
restoredFromBackup: "true"