我正在使用Velero进行集群备份和从 GCP 恢复到 Azure
由于两个 GCP 提供程序的区域/区域不同,k8s 中的持久卷NodeAffinity
具有与 Azure 节点上的标签不匹配的区域和区域选择器。
例如节点 GCP 上的以下标签
failure-domain.beta.kubernetes.io/region=australia-southeast1
failure-domain.beta.kubernetes.io/zone=australia-southeast1-a
在 Azure 上
failure-domain.beta.kubernetes.io/region=australiaeast
failure-domain.beta.kubernetes.io/zone=1
因此,我尝试storage-class
在 Azure 中创建一个,如下所示:
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
但是,当我尝试使用此存储类创建 PVC 时,出现以下错误:
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'"
看起来它正在读取一个空白的“区域名称”。为 Azure 编写此存储类的正确方法是什么?