Create a Block Volume Snapshot

Prev Next

To create a snapshot of a Kubernetes volume using a Kubernetes YAML configuration file:

  1. 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):

    • In medadata:

      • name is the Persistent Volume Claim (PVC) name to store the snapshot.

    • In spec:

      • volumeSnaphotClassName: the name of the block volume snapshot class.

      • In source:

        • persistentVolumeClaimName is the PVC name for the block volume being protected.

    For example:

    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
      name: snapshot-pvc-1
    spec:
      volumeSnapshotClassName: vastdata-snapshot
      source:
        persistentVolumeClaimName: vast-pvc-1
  2. Apply the YAML configuration file:

    kubectl apply -f vast-csi-deployment.yaml
  3. 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