<p>I have setup VMware vSphere Cloud Provider in Kubernetes (Rancher). I'm using Kubernetes' in-tree vSphere cloud provider.</p>
<p>I want to use vSphere storage provider to provision and attach a VMDK to the nodes (the virtual machines).</p>
<p>I get the following error</p>
<pre><code>Failed to provision volume with StorageClass &quot;test-sc&quot;: unsupported key found in matchLabelExpressions: topology.kubernetes.io/region
</code></pre>
<p>The Storageclass YAML file is:</p>
<pre class="lang-yaml prettyprint-override"><code>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]
</code></pre>
<p>I have a similar error when I use <code>failure-domain.beta.kubernetes.io/region</code> :</p>
<pre><code>Failed to provision volume with StorageClass &quot;test-sc&quot;: unsupported key found in matchLabelExpressions: failure-domain.beta.kubernetes.io/region
</code></pre>
<p>The PVC YAML file is:</p>
<pre class="lang-yaml prettyprint-override"><code>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
</code></pre>
<p>Running Kubectl describe...</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    field.cattle.io/creatorId: u-azgclvtap4
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
  creationTimestamp: &quot;2020-10-08T13:01:07Z&quot;
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    cattle.io/creator: norman
  name: test
  namespace: default
  resourceVersion: &quot;24011763&quot;
  selfLink: /api/v1/namespaces/default/persistentvolumeclaims/test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: test-sc
  volumeMode: Filesystem
status:
  phase: Pending
&gt; 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:    &lt;none&gt;
Events:
  Type     Reason              Age                  From                         Message
  ----     ------              ----                 ----                         -------
  Warning  ProvisioningFailed  37s (x7 over 2m15s)  persistentvolume-controller  Failed to provision volume with StorageClass &quot;test-sc&quot;: unsupported key found in matchLabelExpressions: topology.kubernetes.io/region
</code></pre>

Franklin Piat
<p>The current upstream documentation of the <em>Allowed Topologies</em>, doesn't indicate that <code>region</code>is  supported.</p>
<blockquote>
<p>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.</p>
<p>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.</p>
<p>(abstract from <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies</a> )</p>
</blockquote>
<p>The source code for <a href="https://github.com/kubernetes/kubernetes/blob/323f34858de18b862d43c40b2cced65ad8e24052/staging/src/k8s.io/cloud-provider/volume/helpers/zones.go" rel="nofollow noreferrer">zones</a> support in Kubernetes doesn't seems to have an equivalent for regions.</p>
