在AKS中为PVC提供正确的区域信息



我正在使用Velero 从GCP到Azure进行集群备份和恢复

k8s中的持久卷具有NodeAffinity,其区域和区域选择器与Azure节点上的标签不匹配,因为两个GCP提供程序的区域/区域不同。

例如,节点上的以下标签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

因此,我尝试在Azure中创建一个storage-class,如下所示:

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编写此存储类的正确方法是什么?

尝试以下操作。它对我有效。

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

相关内容

  • 没有找到相关文章

最新更新