Creating a Persistent Volume
A Persistent Volume (PV) is a piece of storage in the cluster provisioned by administrators or is dynamically provisioned using Storage Classes.
You can create a Persistent Volume (PV) using the following command:
kubectl apply -f storage-class.yaml
kubectl apply -f pv.yaml
To check whether the Persistent Volume (PV) is created succesfully, use the following command:
For Kubernetes:
kubectl get pv
Sample output:
# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE spe-volume 100Gi RWX Retain Available spe-storage 5s
For OpenShift:
oc get pv
Sample output:
# oc get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE spe-volume 100Gi RWX Retain Available spe-storage 2d20h
A Persistent Volume can be of various types:
Type | Example |
|---|---|
NFS share | storage-class.yaml
pv.yaml
|
Azure File share | storage-class.yaml
pv.yaml
|
Azure File Share as NFS | storage-class.yaml
pv.yaml
|