【问题标题】:How does a kubernetes cluster administrator create VolumeSnapshotContents?Kubernetes 集群管理员如何创建 VolumeSnapshotContents?
【发布时间】:2021-09-19 05:10:51
【问题描述】:

Kubernetes Volume Snapshots concepts documentation 提到可以预先配置卷快照;

集群管理员创建了许多 VolumeSnapshotContents。它们携带存储系统上的真实卷快照的详细信息,可供集群用户使用。它们存在于 Kubernetes API 中,可供使用。

这是怎么做到的?

一些背景知识:我正在尝试从 EBS 快照创建 k8s 卷快照 (VS)。我想使用 VS 来恢复一个使用 Bitnami helm chart 部署的 mongodb 副本集。

我已尝试使用此方法创建 VS 而不创建 VolumeSnapshotContents:

  1. 创建 EBS 快照。
  2. 从快照创建 EBS 卷。
  3. 从 EBS 卷创建持久卷 (PV)。
  4. 创建持久卷声明 (PVC) 以绑定到 PV。
  5. 通过使用 PVC 创建 pod 将 PVC 绑定到 PV。
  6. 从 PVC 创建 VolumeSnapshot (VS)。

最后一步失败并出现此错误:

Events:
  Type     Reason                         Age   From                 Message
  ----     ------                         ----  ----                 -------
  Warning  SnapshotContentCreationFailed  21s   snapshot-controller  Failed to create snapshot content with error cannot find CSI PersistentVolumeSource for volume mongo-with-data

这是因为在步骤 3 中创建的 PV 有 this 作为其 Source:

Source:
    Type:       AWSElasticBlockStore (a Persistent Disk resource in AWS)
    VolumeID:   vol-049483f660a6a66cf
    FSType:
    Partition:  0
    ReadOnly:   false

虽然通过creation of a pod using a PVC 创建的 PV(在幕后)具有此 Source

Source:
    Type:              CSI (a Container Storage Interface (CSI) volume source)
    Driver:            ebs.csi.aws.com
    FSType:            ext4
    VolumeHandle:      vol-05b14044113937bee
    ReadOnly:          false
    VolumeAttributes:      storage.kubernetes.io/csiProvisionerIdentity=1625656807749-8081-ebs.csi.aws.com

两个 PV 具有相同的 StorageClass

【问题讨论】:

    标签: kubernetes amazon-ebs


    【解决方案1】:

    这是怎么做到的?

    底层驱动程序决定了这一点。该驱动程序可以是 CSI 驱动程序或传统的树驱动程序。大多数涉及两个不同驱动程序的场景(即使两者都是 CSI 但它们是不同的 CSI 驱动程序)不受支持,因为许多资源(如VolumeSnapshotContent)本质上是不透明的。这就是第 6 步失败的原因。

    我对整个工作流程感到有点迷茫,我不确定集群是如何设置的,CSI 驱动程序和树中驱动程序都试图使用相同的存储类......但是,你可以让 CSI 类型化步骤 3 中的 PV。你关注了this sample吗?

    我还认为,通过直接利用 EBS 卷而不是创建中间 PV,整个过程可以变得更容易。我没有要确认的 AWS 帐户,但似乎 AWS 为您提供了 EBS 快照 ID,您可以根据 sample 直接在 VolumeSnapshotContent 中引用它。

    【讨论】:

      猜你喜欢
      • 2018-10-27
      • 2015-10-24
      • 2017-06-03
      • 1970-01-01
      • 2020-01-11
      • 2019-04-22
      • 1970-01-01
      • 2019-05-19
      • 1970-01-01
      相关资源
      最近更新 更多