Create persistent volume snapshot
Create a volume snapshot in kubernetes
Step-by-step guide
acloud-toolkit
This is a step-by-step on how to manually create a snapshot. You can use our acloud-toolkit tooling to easily create snapshots
In your cluster there is a VolumeSnapshotClass
resource available. On AWS, the default name is csi-aws-vsc
.
You can view all available classes by performing the following command:
If you see no volumesnapshotclasses
, you may need to upgrade your cluster or the cloud provider your cluster runs in does not support snapshot functionality. Please contact Avisi Cloud support.
Similarly to persistent volumes, we use snapshotclass to determine what driver will be used for creating the snapshot.
Given the following persistent volume as an example of a PVC we want to back-up:
This can be any PVC.
Creating a snapshot
To create a new snapshot, apply the following resource to your cluster:
You can view the created snapshots by performing the following command:
The READYTOUSE
column means you can use the snapshot to create a new persistent volume using the snapshot as a source.
Restoring a snapshot
You can restore a snapshot by creating a new Persistent Volume Claim with a datasource configured. Note the spec.dataSource.name, which refers the VolumeSnapshot previously created.
Restoring a volume may take a minute or so, depending on the size of your snapshot and provider used.
Note that on AWS, disk performance will be slow after the initial restore while AWS is completing restore operations. All data can be read immediately after restore.
Related external documentation
- https://kubernetes.io/docs/concepts/storage/volume-snapshots/
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html
Using acloud-toolkit
When using acloud-toolkit
, you can create a snapshot using the following command:
Last updated on