You can protect Kubernetes volumes using VAST Cluster snapshots.
A snapshot is a reference point that preserves the exact folder structure and data content of a data path at a point in time. Snapshots serve as a virtual copy of the data you had at previous points in time and enable you to restore files or directories after deletion or modification.
You can create snapshots for your Persistent Volume Claims (PVCs) to be able to restore the data based on an existing snapshot.
VAST CSI Driver also supports provisioning for read-only PVCs based on Kubernetes-created snapshots.
To create a snapshot of a Kubernetes volume:
-
Create a YAML configuration file that adds a volume snapshot. In the file (see the example below for correct indentation and line breaks when specifying the keywords):
-
The
metadata: name:
is the Persistent Volume Claim (PVC) name to store the snapshot (snapshot-pvc-1 below). -
The
spec: source: persistentVolumeClaimName
is the PVC name for the volume being protected (vast-pvc-1 below).
For example:
apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: annotations: name: snapshot-pvc-1 spec: source: persistentVolumeClaimName: vast-pvc-1
-
-
Apply the YAML configuration file:
kubectl apply -f vast-csi-deployment.yaml
-
Verify that the PVC snapshot has been created with the following command:
kubectl get vs
The output is similar to the following:
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE snapshot-pvc-1 true vast-pvc-1 0 vastdata-snapshot snapcontent-8b1627cc-d50a-4bdb-a1b4-67931d36eb85 50m 49m
To restore a PVC based on an existing snapshot, attach the snapshot to another PVC:
-
Create a YAML configuration file to attach the snapshot to a PVC. In the file (see the example below for correct indentation and line breaks when specifying the keywords):
-
The
metadata: name:
is the Persistent Volume Claim (PVC) name for the volume that will contain the restored data (pvc-restore below). -
The
storageClassName
is the name of the storage class used for the PVC (vastdata-filesystem below). -
The
dataSource: name:
is the PVC name of the volume that stores the snapshot (snapshot-pvc-1 below).
For example:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-restore spec: accessModes: - ReadWriteMany resources: requests: storage: 1Gi storageClassName: vastdata-filesystem dataSource: name: snapshot-pvc-1 kind: VolumeSnapshot apiGroup: snapshot.storage.k8s.io
-
-
Deploy the YAML configuration file:
kubectl apply -f vast-csi-deployment.yaml
The output is similar to the following:
persistentvolumeclaim/pvc-restore created
-
Verify that the restored PVC can be displayed:
kubectl get pvc
The output is similar to the following:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pvc-restore Bound pvc-c212dc9e-1b72-49da-8a58-8c1ceb97b9e3 1Gi RWX vastdata-filesystem 7s
Comments
0 comments
Article is closed for comments.