Create a VolumeSnapshot
VolumeSnapshot creates a point-in-time snapshot of the independent fileset based IBM Storage Scale Container Storage Interface driver volume on the IBM Storage Scale storage system.
Create a VolumeSnapshotClass
VolumeSnapshotClass is like a StorageClass that defines
driver-specific attributes for the snapshot to be created.
VolumeSnapshotClass is created as shown in the following
example:# cat volumesnapshotclass.yaml
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: ibm-spectrum-scale-snapshot-class-consistency-group
driver: spectrumscale.csi.ibm.com
deletionPolicy: Delete
#parameters:
# snapWindow: "30"snapWindow parameter is valid for only
consistency group. It indicates how long a snapshot stays valid for a consistency group after a
snapshot is taken. The value specified should indicate snapWindow time in minutes. Default value is
"30" minutes.- snapWindow must not be less than 30 minutes while taking snapshots of multiple volumes.
- If there are multiple requests, only one snapshot for consistency group must be taken within the specified snapWindow.
- snapWindow time starts when snapshot of any volume that belongs to the consistency group is taken either for the first time or any time after snapWindow is passed.
- If one needs to take a snapshot of consistency group, request for snapshot for all volumes that belong to the consistency group must be created in a short span of time.
Create a VolumeSnapshot
VolumeSnapshot is a copy of a volume content on a storage system.
Specify the source volume to be used for creating snapshot here as shown in the following sample manifest. Source persistent volume claim (PVC) must be in the same namespace in which the snapshot is being created. Snapshots can be created only from independent fileset-based PVCs or for consistency group-based PVCs.
A sample VolumeSnapshot is created as shown in the following example:
# cat volumesnapshot.yaml
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: ibm-spectrum-scale-snapshot
spec:
volumeSnapshotClassName: ibm-spectrum-scale-snapshot-class
source:
persistentVolumeClaimName: ibm-spectrum-scale-pvc
Verify that snapshot is created
Use the following steps to ensure creation of volume snapshot.
READYTOUSE state and a corresponding file set
snapshot must be available on IBM Storage Scale.- To get the status of volume snapshot, issue the following
command.
# kubectl get volumesnapshot NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE ibm-spectrum-scale-snapshot true ibm-spectrum-scale-pvc 1Gi ibm-spectrum-scale-snapshot-class snapcontent-2b478910-28d1-4c29-8e12-556149095094 2d23h 2d23h
- The volume size of the source PVC is used as the restore size of the snapshot. Any volume that is created from this snapshot must be of the same or larger capacity.
- Volume Snapshot is supported only for the independent fileset based PVCs.