Volume Group Snapshots
Ceph provides the ability to create crash-consistent snapshots of multiple volumes. A group snapshot represents “copies” from multiple volumes that are taken at the same point in time. A group snapshot can be used either to rehydrate new volumes (pre-populated with the snapshot data) or to restore existing volumes to a previous state (represented by the snapshots)
Prerequisites¶
-
Install the snapshot controller, volume group snapshot and snapshot CRDs, refer to VolumeGroupSnapshot documentation here for more details.
-
A
VolumeGroupSnapshotClass
is needed for the volume group snapshot to work. The purpose of aVolumeGroupSnapshotClass
is defined in the kubernetes documentation. In short, as the documentation describes it:
Info
Created by cluster administrators to describe how volume group snapshots should be created. including the driver information, the deletion policy, etc.
Volume Group Snapshots¶
CephFS VolumeGroupSnapshotClass¶
In VolumeGroupSnapshotClass, the csi.storage.k8s.io/group-snapshotter-secret-name
parameter should reference the name of the secret created for the cephfs-plugin.
In the VolumeGroupSnapshotClass
, update the value of the clusterID
field to match the namespace that Rook is running in. When Ceph CSI is deployed by Rook, the operator will automatically maintain a configmap whose contents will match this key. By default this is "rook-ceph".
CephFS VolumeGroupSnapshot¶
In VolumeGroupSnapshot, volumeGroupSnapshotClassName
should be the name of the VolumeGroupSnapshotClass
previously created. The labels inside matchLabels
should be present on the PVCs that are already created by the CephFS CSI driver.
Verify CephFS GroupSnapshot Creation¶
The snapshot will be ready to restore to a new PVC when READYTOUSE
field of the volumegroupsnapshot
is set to true.
Restore the CephFS volume group snapshot to a new PVC¶
Find the name of the snapshots created by the VolumeGroupSnapshot
first by running:
It will list the PVC's name followed by its snapshot name.
In pvc-restore, dataSource
should be one of the Snapshot
that we just found. The dataSource
kind should be the VolumeSnapshot
.
Create a new PVC from the snapshot
Verify CephFS Restore PVC Creation¶
CephFS volume group snapshot resource Cleanup¶
To clean the resources created by this example, run the following: