
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
If you are not familiar with Volume Snapshots, check out my article OpenShift - Getting Started with Volume Snapshots.
This assumes you have already
A persistent volume (PV) is the "physical" volume (such as a hard disk drive or solid state drive) on the host machine (node) that stores your persistent data, whereas a persistent volume claim (PVC) is a reference to a persistent volume, used by a pod.
Persistent Volume Claims
The oc get persistentvolumeclaims command will return the list of Persistent Volume Claims. Let's say you have a Persistent Volume Claim named my-pvc.
TIP
The -A or --all-namespaces flag can be used to list the Persistent Volume Claims in every project / namespace.
The -n or --namespace flag can be used to list the Persistent Volume Claims in a certain project / namespace.
]$ oc get persistentvolumeclaims --all-namespaces
NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
my-project my-pvc Bound pvc-816c11cc-c30d-40b2-9a5b-25f6a2203475 10Gi RWX thin-cli <unset> 299d
Storage Class
Notice in this example that Persistent Volume Clain my-pvc is using Storage Class thin-csi. The oc get StorageClasses command can be used to list the Storage Classes that have been added to your OpenShift cluster. By the way, CSI stands for Container Storage Interface. Notice in this example that Storage Class thin-cli maps to provisioner csi.vsphere.vmware.com.
]$ oc get StorageClasses
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
file-storage (default) csi.trident.netapp.io Delete Immediate true 654d
thin kubernetes.io/vsphere-volume Delete Immediate false 657d
thin-csi csi.vsphere.vmware.com Delete WaitForFirstConsumer true 657d
Volume Storage Class
Let's say you want to create a volume snapshot of my-pvc. In this example, since Persistent Volume Claim my-pvc is using Storage Class thin-csi and Storage Class thin-csi maps to provisioner csi.vsphere.vmware.com a Volume Snapshot Class for csi.vsphere.vmware.com will be needed. Let's say you have the following in a YAML file.
apiVersion: snapshot.storage.k8s.io/v1
deletionPolicy: Delete
driver: csi.vsphere.vmware.com
kind: VolumeSnapshotClass
metadata:
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
name: csi-vsphere-vsc
The oc apply command can be used to create the Volume Snapshot Class from the YAML file.
oc apply --filename csi-vsphere-vsc.yaml
Or in the OpenShift console, at Storage > VolumeStorageClasses you can click on the Create VolumeSnapshotClass button.

And now the oc get VolumeSnapshotClasses command can be used to confirm that the Volume Snapshot Class exists.
]$ oc get VolumeSnapshotClasses
NAME DRIVER DELETIONPOLICY AGE
csi-vsphere-vsc csi.vsphere.vmware.com Delete 2m5s
Or you can see this in the OpenShift console at Storage > VolueSnapshotClasses.

Did you find this article helpful?
If so, consider buying me a coffee over at