Create PV
To create a PV, you need to first create a PVC. Once done, IOMesh will detect the creation of the PVC and automatically generate a new PV based on its specs, binding them together. Then the pair of PV and PVC will be ready for use.
NOTE: IOMesh supports access modes
ReadWriteOnce
,ReadWriteMany
,andReadOnlyMany
, butReadWriteMany
andReadOnlyMany
are only for PVs withvolumemode
as Block.
Prerequisite
Ensure that there is already a StorageClass available for use.
Procedure
Create a YAML config
pvc.yaml
. Configure the fieldsaccessModes
,storage
, andvolumeMode
.# Source: pvc.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: iomesh-example-pvc spec: storageClassName: iomesh-csi-driver accessModes: - ReadWriteOnce # Specify the access mode. resources: requests: storage: 10Gi # Specify the storage value. volumeMode: Filesystem # Specify the volume mode.
For details, refer to Kubernetes Persistent Volumes.
Apply the YAML config to create the PVC. Once done, the corresponding PV will be created.
kubectl apply -f pvc.yaml
Verify that the PVC was created.
kubectl get pvc iomesh-example-pvc
If successful, you should see output like this:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE iomesh-example-pvc Bound pvc-34230f3f-47dc-46e8-8c42-38c073c40598 10Gi RWO iomesh-csi-driver 21h
View the PV bound to this PVC. You can find the PV name from the PVC output.
kubectl get pv pvc-34230f3f-47dc-46e8-8c42-38c073c40598
If successful, you should see output like this:
NAME CAPACITY RECLAIM POLICY STATUS CLAIM STORAGECLASS pvc-34230f3f-47dc-46e8-8c42-38c073c40598 10Gi Delete Bound default/iomesh-example-pvc iomesh-csi-driver