【发布时间】:2021-09-19 05:10:51
【问题描述】:
Kubernetes Volume Snapshots concepts documentation 提到可以预先配置卷快照;
集群管理员创建了许多 VolumeSnapshotContents。它们携带存储系统上的真实卷快照的详细信息,可供集群用户使用。它们存在于 Kubernetes API 中,可供使用。
这是怎么做到的?
一些背景知识:我正在尝试从 EBS 快照创建 k8s 卷快照 (VS)。我想使用 VS 来恢复一个使用 Bitnami helm chart 部署的 mongodb 副本集。
我已尝试使用此方法创建 VS 而不创建 VolumeSnapshotContents:
- 创建 EBS 快照。
- 从快照创建 EBS 卷。
- 从 EBS 卷创建持久卷 (PV)。
- 创建持久卷声明 (PVC) 以绑定到 PV。
- 通过使用 PVC 创建 pod 将 PVC 绑定到 PV。
- 从 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