A PersistentVolumeClaim (PVC) resource exists in the cluster.
You can manually back up your volumes using the VolumeSnapshot Kubernetes resource. When you create a volume snapshot, you copy your volume's contents at that particular point in time. A VolumeSnapshot resource requires an existing source PVC and a VolumeSnapshotClass resource specified. Taking volume snapshots is possible thanks to Container Storage Interface (CSI) drivers, which allow third-party storage providers to expose storage systems in Kubernetes. The driver must be specified in the VolumeSnapshotClass resource.
-
Create a VolumeSnapshot resource using the default VolumeSnapshotClass and your PVC name:
kubectl apply -n {NAMESPACE} -f <<EOF apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: name: snapshot spec: volumeSnapshotClassName: default source: persistentVolumeClaimName: {YOUR_PVC_NAME} EOF
The VolumeSnapshot resource is created.
-
To verify that the snapshot was taken successfully, run
kubectl get -n {NAMESPACE} volumesnapshot -w
and check that the field READYTOUSE has statustrue
.