0

I am doing a cluster backup and restore from GCP to Azure using Velero

The persistent volumes in k8s have NodeAffinity which has the zone and region selectors that don't match with the lables on the Azure node, because of the difference in zones/regions of the two GCP providers.

e.g. the following labels on nodes GCP

failure-domain.beta.kubernetes.io/region=australia-southeast1
failure-domain.beta.kubernetes.io/zone=australia-southeast1-a

and on Azure

failure-domain.beta.kubernetes.io/region=australiaeast
failure-domain.beta.kubernetes.io/zone=1

So, I tried to create a storage-class in Azure like the following:

kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: fast-azure
provisioner: kubernetes.io/azure-disk
allowVolumeExpansion: true
parameters:
  cachingmode: ReadOnly
  kind: Managed
  storageaccounttype: Premium_LRS
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
  - key: failure-domain.beta.kubernetes.io/zone
    values:
    - "1"
  - key: failure-domain.beta.kubernetes.io/region
    values:
    - australiaeast

But when I try to create a PVC using this storage class, I get the following error:

arning  ProvisioningFailed    1s (x6 over 29s)   persistentvolume-controller  Failed to provision volume with StorageClass "fast-azure": compute.DisksClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidAvailabilityZone" Message="The zone(s) '' for resource 'Microsoft.Compute/disks/kubernetes-dynamic-pvc-105101ea-2c58-4a5a-8eeb-386c7489b782' is not supported. The supported zones for location 'australiaeast' are '1,2,3'"

Looks like it's reading a blank '' zone name. What's the correct way to write this storageclass for Azure?

kosta
  • 4,302
  • 10
  • 50
  • 104

1 Answers1

1

Try the following. It worked for me.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: azure-disk
parameters:
  cachingmode: None
  kind: Managed
  zoned: "true"
  storageaccounttype: Standard_LRS
provisioner: kubernetes.io/azure-disk
allowedTopologies:
- matchLabelExpressions:
  - key: failure-domain.beta.kubernetes.io/zone
    values:
    - australiaeast-1