Snapshots
Prerequisites¶
-
Install the snapshot controller and snapshot v1 CRD.
-
We also need a
VolumeSnapshotClass
for volume snapshot to work. The purpose of aVolumeSnapshotClass
is defined in the kubernetes documentation. In short, as the documentation describes it:
Info
Just like StorageClass provides a way for administrators to describe the "classes" of storage they offer when provisioning a volume, VolumeSnapshotClass provides a way to describe the "classes" of storage when provisioning a volume snapshot.
RBD Snapshots¶
RBD VolumeSnapshotClass¶
In VolumeSnapshotClass, the csi.storage.k8s.io/snapshotter-secret-name
parameter should reference the name of the secret created for the rbdplugin and pool
to reflect the Ceph pool name.
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".
Volumesnapshot¶
In snapshot, volumeSnapshotClassName
should be the name of the VolumeSnapshotClass
previously created. The persistentVolumeClaimName
should be the name of the PVC which is already created by the RBD CSI driver.
Verify RBD Snapshot Creation¶
The snapshot will be ready to restore to a new PVC when the READYTOUSE
field of the volumesnapshot
is set to true.
Restore the RBD snapshot to a new PVC¶
In pvc-restore, dataSource
should be the name of the VolumeSnapshot
previously created. The dataSource
kind should be the VolumeSnapshot
. The storageClassName
can be any RBD storageclass.
Please Note: * provisioner
must be the same for both the Parent PVC and the restored PVC. * The non-encrypted PVC cannot be restored to an encrypted one and vice-versa. * encrypted -> encrypted (possible) * non-encrypted -> non-encrypted (possible) * encrypted -> non-encrypted (not possible) * non-encrypted -> encrypted (not possible)
Create a new PVC from the snapshot
Verify RBD Clone PVC Creation¶
RBD snapshot resource Cleanup¶
To clean your cluster of the resources created by this example, run the following:
CephFS Snapshots¶
CephFS VolumeSnapshotClass¶
In VolumeSnapshotClass, the csi.storage.k8s.io/snapshotter-secret-name
parameter should reference the name of the secret created for the cephfsplugin.
In the volumesnapshotclass, 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".
VolumeSnapshot¶
In snapshot, volumeSnapshotClassName
should be the name of the VolumeSnapshotClass
previously created. The persistentVolumeClaimName
should be the name of the PVC which is already created by the CephFS CSI driver.
Verify CephFS Snapshot Creation¶
The snapshot will be ready to restore to a new PVC when READYTOUSE
field of the volumesnapshot
is set to true.
Restore the CephFS snapshot to a new PVC¶
In pvc-restore, dataSource
should be the name of the VolumeSnapshot
previously created. The dataSource
kind should be the VolumeSnapshot
.
Create a new PVC from the snapshot
Verify CephFS Restore PVC Creation¶
CephFS snapshot resource Cleanup¶
To clean your cluster of the resources created by this example, run the following: