Skip to main content
Version: 26.2

Snapshot of FlashArray PVC

PX-CSI supports snapshot and restore functionality for FlashArray Direct Access volumes. This page describes how to create on-demand snapshots, restore volumes from those snapshots, and delete snapshots when they are no longer needed. Snapshots are useful for point-in-time rollback.

note

FlashArray file services do not support snapshots.

Snapshot deletion
  • On FlashArray, deleting a volume also deletes its associated snapshots by default. This applies whether the volume is deleted directly on the array or by deleting a PersistentVolumeClaim (PVC) in Kubernetes with the reclaim policy set to delete.
  • Starting in PX-CSI version 25.8.1, you can prevent this behavior by setting the parameters.type field to clone in the VolumeSnapshotClass. When type is set to clone, each snapshot is preserved as a new volume on FlashArray, preventing its deletion when the original PVC is removed.

Take a Snapshot

PX-CSI supports two types of snapshots for PVCs on FlashArray:

  • Single PVC snapshot: Captures the state of one PVC at a specific point in time. Use this snapshot type for individual volume backups or to create test environments from a specific volume.
  • Group snapshot: Creates a crash-consistent snapshot of multiple PVCs in a single operation, backed by a FlashArray protection group snapshot. Use this snapshot type for applications that span multiple PVCs, such as a database with separate data and log volumes, when you require consistency across all volumes at the same point in time.

Single PVC snapshot

  1. Create a VolumeSnapshotClass:
    Define a VolumeSnapshotClass with the driver field set to pxd.portworx.com. This class specifies the storage provider for managing snapshots. For example:

    kind: VolumeSnapshotClass
    apiVersion: snapshot.storage.k8s.io/v1
    metadata:
    name: px-fa-direct-access-snapshotclass
    annotations:
    snapshot.storage.kubernetes.io: "true"
    driver: pxd.portworx.com
    deletionPolicy: Delete
    parameters:
    # type: "clone" # Set this parameter to "clone" to preserve each snapshot as a new volume on FlashArray. This prevents snapshots from being deleted when the source volume is deleted.
  2. Create a VolumeSnapshot:
    Define a VolumeSnapshot that links to the VolumeSnapshotClass and the source PVC. This configuration captures the current state of the PVC. For example:

    kind: VolumeSnapshot
    apiVersion: snapshot.storage.k8s.io/v1
    metadata:
    name: volumesnapshot-of-pure-claim-block
    spec:
    volumeSnapshotClassName: px-fa-direct-access-snapshotclass
    source:
    persistentVolumeClaimName: pure-claim-block
  3. Confirm the snapshot:
    Apply the snapshot configuration and verify its creation using the following command:

    kubectl get volumesnapshot

    Alternatively, check the array UI under Volume Snapshots, where snapshots are managed like other Pure snapshots.

    note
    • If the snapshot does not appear with the kubectl get volumesnapshot command, retrieve the full CRD path using:
      kubectl get crd
      Then run the command with the full path, for example:
      kubectl get volumesnapshots.snapshot.storage.k8s.io
    • Snapshots of unattached volumes will be empty and unattachable. To create an attachable snapshot with a filesystem, attach and detach the volume before taking the snapshot.

Group snapshot

VolumeGroupSnapshot support requires:

  • PX-CSI version 26.2.0 or later
  • Kubernetes version 1.34 or later
  • Purity version 6.4.10 or later
  • All PVCs in the group to be provisioned on the same FlashArray.
  1. Add labels to the PVCs that you want to include in the group. All PVCs must use the same label. For example:

    kubectl label pvc <pvc-name-1> app=<my-app> -n <namespace>
    kubectl label pvc <pvc-name-2> app=<my-app> -n <namespace>
  2. Create a VolumeGroupSnapshotClass that uses the pxd.portworx.com driver:

    apiVersion: groupsnapshot.storage.k8s.io/v1beta2
    kind: VolumeGroupSnapshotClass
    metadata:
    name: pure-vgs-class
    driver: pxd.portworx.com
    deletionPolicy: Delete
  3. Create a VolumeGroupSnapshot that selects PVCs by label:

    apiVersion: groupsnapshot.storage.k8s.io/v1beta2
    kind: VolumeGroupSnapshot
    metadata:
    name: my-app-group-snap
    namespace: <namespace>
    spec:
    volumeGroupSnapshotClassName: pure-vgs-class
    source:
    selector:
    matchLabels:
    app: <my-app>
  4. Verify the group snapshot and the individual member snapshots:

    kubectl get volumegroupsnapshot -n <namespace>
    kubectl get volumesnapshot -n <namespace>

    On the FlashArray, PX-CSI creates or reuses a protection group for the member volumes and creates a protection group snapshot. Kubernetes also creates an individual VolumeSnapshot object for each PVC in the group, which you can restore by using the standard restore workflow.

Restore a Snapshot

Restoring a snapshot allows you to create a new PVC from a snapshot, which can be useful for recovering data or creating test environments. This workflow applies to single PVC snapshots and to individual member snapshots within a group snapshot.

  1. Define a new PersistentVolumeClaim:
    Create a PersistentVolumeClaim specification that sets dataSource.kind to VolumeSnapshot and dataSource.name to the snapshot name. This ensures the new PVC is restored from the specified snapshot. For example:

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
    name: pvc-restore
    spec:
    accessModes:
    - ReadWriteOnce
    resources:
    requests:
    storage: 20Gi # Must match the original PVC size
    storageClassName: sc-portworx-fa-direct-access
    dataSource:
    kind: VolumeSnapshot
    name: volumesnapshot-of-pure-claim-block
    apiGroup: snapshot.storage.k8s.io
  2. Confirm the restored PVC:
    Apply the PersistentVolumeClaim configuration and verify its creation using the following command:

    kubectl get pvc <pvc-name> -n <pvc-namespace>

    Alternatively, check the FlashArray UI under volume Details, where the source of the new volume will be listed as the snapshot's original PVC.

Delete a Snapshot

Single PVC snapshot

Delete the VolumeSnapshot object to remove the snapshot:

kubectl delete volumesnapshot <snapshot-name> -n <namespace>

Group snapshot

Delete the VolumeGroupSnapshot object to remove the group snapshot and all member snapshots from the FlashArray:

kubectl delete volumegroupsnapshot <group-snapshot-name> -n <namespace>
note

Individual snapshots that belong to a group cannot be deleted independently. You must delete the entire VolumeGroupSnapshot.

When a protection group no longer contains group snapshots, PX-CSI automatically removes the protection group from the FlashArray.