【问题标题】:Provision PVCs with correct zone information in AKS在 AKS 中为 PVC 提供正确的区域信息
【发布时间】:2020-03-15 23:18:41
【问题描述】:

我正在使用 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 编写这个存储类的正确方法是什么?

【问题讨论】:

  • 您是否尝试将值从"1" 更改为1

标签: kubernetes azure-aks persistent-volume-claims storage-class-specifier


【解决方案1】:

试试下面的。它对我有用。

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

【讨论】:

    猜你喜欢
    • 2021-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-02
    • 2021-06-01
    • 1970-01-01
    • 2021-10-02
    相关资源
    最近更新 更多