Franklin Piat
Franklin Piat

Reputation: 4561

StorageClass ProvisioningFailed: unsupported key found in matchLabelExpressions: topology.kubernetes.io/region

I have setup VMware vSphere Cloud Provider in Kubernetes (Rancher). I'm using Kubernetes' in-tree vSphere cloud provider.

I want to use vSphere storage provider to provision and attach a VMDK to the nodes (the virtual machines).

I get the following error

Failed to provision volume with StorageClass "test-sc": unsupported key found in matchLabelExpressions: topology.kubernetes.io/region

The Storageclass YAML file is:

kind: StorageClass
apiVersion: storage.k8s.io/v1
allowVolumeExpansion: false
metadata:
  name: test-sc
parameters:
  datastore: TESTDATASTORE
  diskformat: zeroedthick
  fstype: ext4
provisioner: kubernetes.io/vsphere-volume
reclaimPolicy: Delete
#volumeBindingMode: WaitForFirstConsumer
volumeBindingMode: Immediate
allowedTopologies:
  - matchLabelExpressions:
#    - key: failure-domain.beta.kubernetes.io/region
   - key: topology.kubernetes.io/region
      values: [region-a]
#    - key: failure-domain.beta.kubernetes.io/zone
    - key: topology.kubernetes.io/zone
      values: [zone-a]

I have a similar error when I use failure-domain.beta.kubernetes.io/region :

Failed to provision volume with StorageClass "test-sc": unsupported key found in matchLabelExpressions: failure-domain.beta.kubernetes.io/region

The PVC YAML file is:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  finalizers:
  - kubernetes.io/pvc-protection
  name: test
  namespace: default
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: test-sc
  volumeMode: Filesystem

Running Kubectl describe...

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    field.cattle.io/creatorId: u-azgclvtap4
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
  creationTimestamp: "2020-10-08T13:01:07Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    cattle.io/creator: norman
  name: test
  namespace: default
  resourceVersion: "24011763"
  selfLink: /api/v1/namespaces/default/persistentvolumeclaims/test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: test-sc
  volumeMode: Filesystem
status:
  phase: Pending
> kubectl describe  pvc/test        
Name:          test
Namespace:     default
StorageClass:  test-sc
Status:        Pending
Volume:        
Labels:        cattle.io/creator=norman
Annotations:   field.cattle.io/creatorId: u-azgclvtap4
               volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    <none>
Events:
  Type     Reason              Age                  From                         Message
  ----     ------              ----                 ----                         -------
  Warning  ProvisioningFailed  37s (x7 over 2m15s)  persistentvolume-controller  Failed to provision volume with StorageClass "test-sc": unsupported key found in matchLabelExpressions: topology.kubernetes.io/region

Upvotes: 0

Views: 533

Answers (2)

Nithin Thomas
Nithin Thomas

Reputation: 1

It should be given as a zone, the region is not supported

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: region1storageclass
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
  encrypted: "true" # if encryption required, kms keys need to be created
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
  - key: failure-domain.beta.kubernetes.io/zone
    values:
    - eu-east-2b

Upvotes: 0

Franklin Piat
Franklin Piat

Reputation: 4561

The current upstream documentation of the Allowed Topologies, doesn't indicate that regionis supported.

When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required, allowedTopologies can be specified.

This example demonstrates how to restrict the topology of provisioned volumes to specific zones and should be used as a replacement for the zone and zones parameters for the supported plugins.

(abstract from https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies )

The source code for zones support in Kubernetes doesn't seems to have an equivalent for regions.

Upvotes: 1

Related Questions