Skip to main content
A newer release of this product is available.

Work with snapshots

Contributors juliantap

You can create Kubernetes VolumeSnapshots (volume snapshot) of Persistent Volumes (PVs) to maintain point-in-time copies of Astra Trident volumes. Additionally, you can create a new volume, also known as a clone, from an existing volume snapshot. Volume snapshot is supported by ontap-nas, ontap-nas-flexgroup, ontap-san, ontap-san-economy, solidfire-san, gcp-cvs, and azure-netapp-files drivers.

Before you begin

You must have an external snapshot controller and Custom Resource Definitions (CRDs). This is the responsibility of the Kubernetes orchestrator (for example: Kubeadm, GKE, OpenShift).

If your Kubernetes distribution does not include the snapshot controller and CRDs, refer to Deploying a volume snapshot controller.

Note Don’t create a snapshot controller if creating on-demand volume snapshots in a GKE environment. GKE uses a built-in, hidden snapshot controller.

Step 1: Create a VolumeSnapshotClass

This example creates a volume snapshot class.

cat snap-sc.yaml
kind: VolumeSnapshotClass
  name: csi-snapclass
deletionPolicy: Delete

The driver points to Astra Trident’s CSI driver. deletionPolicy can be Delete or Retain. When set to Retain, the underlying physical snapshot on the storage cluster is retained even when the VolumeSnapshot object is deleted.

For more information, refer to VolumeSnapshotClass.

Step 2: Create a snapshot of an existing PVC

This example creates a snapshot of an existing PVC.

cat snap.yaml
kind: VolumeSnapshot
  name: pvc1-snap
  volumeSnapshotClassName: csi-snapclass
    persistentVolumeClaimName: pvc1

In this example, the snapshot is created for a PVC named pvc1 and the name of the snapshot is set to pvc1-snap.

kubectl create -f snap.yaml created

kubectl get volumesnapshots
NAME                   AGE
pvc1-snap              50s

This created a VolumeSnapshot object. A VolumeSnapshot is analogous to a PVC and is associated with a VolumeSnapshotContent object that represents the actual snapshot.

It is possible to identify the VolumeSnapshotContent object for the pvc1-snap VolumeSnapshot by describing it.

kubectl describe volumesnapshots pvc1-snap
Name:         pvc1-snap
Namespace:    default
  Snapshot Class Name:    pvc1-snap
  Snapshot Content Name:  snapcontent-e8d8a0ca-9826-11e9-9807-525400f3f660
    API Group:
    Kind:       PersistentVolumeClaim
    Name:       pvc1
  Creation Time:  2019-06-26T15:27:29Z
  Ready To Use:   true
  Restore Size:   3Gi

The Snapshot Content Name identifies the VolumeSnapshotContent object which serves this snapshot. The Ready To Use parameter indicates that the Snapshot can be used to create a new PVC.

Step 3: Create PVCs from VolumeSnapshots

This example creates a PVC using a snapshot:

cat pvc-from-snap.yaml
apiVersion: v1
kind: PersistentVolumeClaim
  name: pvc-from-snap
    - ReadWriteOnce
  storageClassName: golden
      storage: 3Gi
    name: pvc1-snap
    kind: VolumeSnapshot

dataSource shows that the PVC must be created using a VolumeSnapshot named pvc1-snap as the source of the data. This instructs Astra Trident to create a PVC from the snapshot. After the PVC is created, it can be attached to a pod and used just like any other PVC.

Note When deleting a Persistent Volume with associated snapshots, the corresponding Trident volume is updated to a “Deleting state”. For the Astra Trident volume to be deleted, the snapshots of the volume should be removed.

Deploying a volume snapshot controller

If your Kubernetes distribution does not include the snapshot controller and CRDs, you can deploy them as follows.

  1. Create volume snapshot CRDs.

    # Create volume snapshot CRDs
    kubectl apply -f
    kubectl apply -f
    kubectl apply -f
  2. Create the snapshot controller in the desired namespace. Edit the YAML manifests below to modify namespace.

    kubectl apply -f
    kubectl apply -f