Skip to main content
Version: 3.1

create-pvc-pure-flasharray

On-premises users who want to use Pure Storage FlashArray with Portworx on Kubernetes can attach FlashArray as a Direct Access volume. Used in this way, Portworx directly provisions FlashArray volumes, maps them to a user PVC, and mounts them to pods. Once mounted, the application writes data directly onto FlashArray. As a result, this mounting method doesn’t use storage pools.

FlashArray Direct Access volumes support the following CSI operations:

  • Basic filesystem operations: create, mount, expand, clone, unmount, delete
  • Mount options: Configure file system mount options
  • Snapshots
  • Quality of service (QoS) settings (requires at least one FlashArray with Purity version 5.3.0 or newer and REST API version 1.17 or newer)
note
  • Portworx recommends installing Portworx with FlashArray Cloud Drive before using FlashArray Direct Access volumes.

  • FlashArray Direct Access volumes have the following limitations:

    • RawBlock, volume import, and CSI ephemeral volumes are not supported.
    • CreateOperations is not honored by Portworx.

Use FlashArray as a Direct Access volume

Once you’ve configured Portworx to work with your FlashArray, you can create a StorageClass and reference it in any PVCs you create.

Create a StorageClass

Create a StorageClass spec and set parameters.backend to "pure_block". Here is an example StorageClass spec:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: sc-portworx-fa-direct-access
provisioner: pxd.portworx.com
parameters:
backend: "pure_block"
max_iops: "1000"
max_bandwidth: "1G"
allowVolumeExpansion: true

Create a PVC

Create a PersistentVolumeClaim and reference the StorageClass you created by entering the name that you gave your StorageClass in the spec.storageClassName field. For example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pure-claim-block
labels:
app: nginx
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: sc-portworx-fa-direct-access

Mount to a pod

Create a Pod and reference the PVC you created by entering the name you gave your PVC in the persistentVolumeClaim.claimName field. For example:

kind: Pod
apiVersion: v1
metadata:
name: nginx-pod
labels:
app: nginx
spec:
volumes:
- name: pure-vol
persistentVolumeClaim:
claimName: pure-claim-block
containers:
- name: nginx
image: nginx
volumeMounts:
- name: pure-vol
mountPath: /data
ports:
- containerPort: 80

Once you apply the Pod, you can use watch kubectl get pods to look for a STATUS of Running. Once the pod is running, you can see it as a connected host for your volume.

Clone a PVC

To clone PVC, create a PersistentVolumeClaim with dataSource.kind set to PVC and dataSource.name set to the name of the PVC you wish to clone. For example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-clone
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: sc-portworx-fa-direct-access
dataSource:
kind: PersistentVolumeClaim
name: pure-claim-block

Take a snapshot

To take a snapshot, perform the following steps:

  1. Create a SnapshotClass with driver set to pxd.portworx.com. For example:

    kind: VolumeSnapshotClass
    apiVersion: snapshot.storage.k8s.io/v1
    metadata:
    name: px-fa-direct-access-snapshotclass
    annotations:
    snapshot.storage.kubernetes.io/is-default-class: "true"
    driver: pxd.portworx.com
    deletionPolicy: Delete
  2. Create a VolumeSnapshot where volumeSnapshotClassName is set to the name you gave your VolumeSnapshotClass, and source.persistentVolumeClaimName is set to the name you gave your volume. 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

Once you have applied the VolumeSnapshot to create a snapshot, you can view the snapshot with kubectl get volumesnapshot or in the array UI under Volume Snapshots, where it has the same functions as other types of Pure snapshots.

note
  • If you do not see your VolumeSnapshot when you run kubectl get volumesnapshot, run kubectl get crd to get the full path of the CRD, then use that full path in your kubectl get command. For example:

    kubectl get volumesnapshots.snapshot.storage.k8s.io
  • A snapshot of a volume that has not been attached will be completely empty. It will include no filesystem, making it unattachable. If you want an attachable but empty snapshot with a filesystem, attach and detach the volume before taking the snapshot.

Restore a snapshot

To restore a snapshot to a new PVC, create a PersistentVolumeClaim with dataSource.kind set to VolumeSnapshot and dataSource.name set to the name of your VolumeSnapshot. For example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-restore
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: sc-portworx-fa-direct-access
dataSource:
kind: VolumeSnapshot
name: volumesnapshot-of-pure-claim-block
apiGroup: snapshot.storage.k8s.io

Once you have applied the PersistentVolumeClaim to create a PVC, you can view it with kubectl get pvc or in the array UI. The array UI shows under Details that the source of the new PVC is the PVC from which the snapshot was made.

Expand a PVC

To expand a PVC of a FlashArray direct access volume, run the command kubectl edit pvc <pvcName>, then change the size in the spec.

Delete a PVC

To delete a PVC of a FlashArray direct access volume, use the following command:

kubectl delete pvc <pvcName>

Was this page helpful?