1

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"
maze
  • 162
  • 1
  • 8

1 Answers1

2

Did you try by specifying a storageClassName since Kubernetes will be using default storage class when it's not specified? See Dynamic Provisioning of the blog post and Dynamic from Kubernetes documentation? Or try with by removing the default storageclass in the cluster to explicitly use given PV and PVC configuration.

cnu
  • 194
  • 7