Home > Storage > PowerFlex > White Papers > Amazon Elastic Kubernetes Service Anywhere Bare Metal on Dell PowerFlex > Use case 3: Snapshot with PowerFlex CSI
This use case describes how to take a snapshot with PowerFlex CSI:
apiVersion: v1 kind: ServiceAccount metadata: name: vxflextest namespace: helmtest-vxflexos --- kind: StatefulSet apiVersion: apps/v1 metadata: name: vxflextest namespace: helmtest-vxflexos spec: selector: matchLabels: app: vxflextest serviceName: 2vols template: metadata: labels: app: vxflextest spec: serviceAccount: vxflextest containers: - name: test image: docker.io/centos:latest command: [ "/bin/sleep", "3600" ] volumeMounts: - mountPath: "/data0" name: pvol0 - mountPath: "/data1" name: pvol1 volumes: - name: pvol0 persistentVolumeClaim: claimName: pvol0 - name: pvol1 persistentVolumeClaim: claimName: pvol1 |
The following YAML file is used to deploy the Pod 1 with the PVC:
apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: name: pvol0-snap1 namespace: helmtest-vxflexos spec: volumeSnapshotClassName: vxflexos-snapclass source: persistentVolumeClaimName: pvol0 |
The following YAML file is used to provision the PVC:
apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: name: pvol0-snap2 namespace: helmtest-vxflexos spec: volumeSnapshotClassName: vxflexos-snapclass source: persistentVolumeClaimName: pvol0 |
The following script is used for the Snapshot test.
#!/bin/bash NS=helmtest-vxflexos source ./common.bash
echo "creating snap1 of pvol0" kubectl create -f snap1.yaml sleep 10 kubectl get volumesnapshot -n ${NS} kubectl describe volumesnapshot -n ${NS} sleep 10 echo "creating snap2 of pvol0" kubectl create -f snap2.yaml sleep 10 kubectl describe volumesnapshot -n ${NS} sleep 10 echo "deleting snapshots..." kubectl delete volumesnapshot pvol0-snap1 -n ${NS} sleep 10 kubectl delete volumesnapshot pvol0-snap2 -n ${NS} sleep 10 kubectl get volumesnapshot -n ${NS} |
The following sample shows the output of the test:
$ bash ./snaptest.sh creating snap1 of pvol0 volumesnapshot.snapshot.storage.k8s.io/pvol0-snap1 created NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE pvol0-snap1 pvol0 vxflexos-snapclass 10s Name: pvol0-snap1 Namespace: helmtest-vxflexos Labels: <none>
Annotations: <none> API Version: snapshot.storage.k8s.io/v1 Kind: VolumeSnapshot Metadata: Creation Timestamp: 2022-07-13T15:51:57Z Generation: 1 Managed Fields: API Version: snapshot.storage.k8s.io/v1 Fields Type: FieldsV1 fieldsV1: f:spec: .: f:source: .: f:persistentVolumeClaimName: f:volumeSnapshotClassName: Manager: kubectl-create Operation: Update Time: 2022-07-13T15:51:57Z Resource Version: 7151834 UID: fe7fc0f8-120b-4404-bca9-f79ededce1cb Spec: Source: Persistent Volume Claim Name: pvol0 Volume Snapshot Class Name: vxflexos-snapclass Events: <none> creating snap2 of pvol0 volumesnapshot.snapshot.storage.k8s.io/pvol0-snap2 created Name: pvol0-snap1 Namespace: helmtest-vxflexos Labels: <none> Annotations: <none> API Version: snapshot.storage.k8s.io/v1 Kind: VolumeSnapshot Metadata: Creation Timestamp: 2022-07-13T15:51:57Z Generation: 1 Managed Fields: API Version: snapshot.storage.k8s.io/v1 Fields Type: FieldsV1 fieldsV1: f:spec: .: f:source: .: f:persistentVolumeClaimName: f:volumeSnapshotClassName: Manager: kubectl-create Operation: Update Time: 2022-07-13T15:51:57Z Resource Version: 7151834 UID: fe7fc0f8-120b-4404-bca9-f79ededce1cb Spec: Source: Persistent Volume Claim Name: pvol0 Volume Snapshot Class Name: vxflexos-snapclass Events: <none>
Name: pvol0-snap2 Namespace: helmtest-vxflexos Labels: <none> Annotations: <none> API Version: snapshot.storage.k8s.io/v1 Kind: VolumeSnapshot Metadata: Creation Timestamp: 2022-07-13T15:52:17Z Generation: 1 Managed Fields: API Version: snapshot.storage.k8s.io/v1 Fields Type: FieldsV1 fieldsV1: f:spec: .: f:source: .: f:persistentVolumeClaimName: f:volumeSnapshotClassName: Manager: kubectl-create Operation: Update Time: 2022-07-13T15:52:17Z Resource Version: 7151901 UID: b915f17e-5f15-48ab-a4c7-25c3901e97ca Spec: Source: Persistent Volume Claim Name: pvol0 Volume Snapshot Class Name: vxflexos-snapclass Events: <none> deleting snapshots... volumesnapshot.snapshot.storage.k8s.io "pvol0-snap1" deleted volumesnapshot.snapshot.storage.k8s.io "pvol0-snap2" deleted No resources found in helmtest-vxflexos namespace.
|