Dynamic Volume Provisioning Example Using a Pod
A PersistentVolumeClaim is a request for abstract storage resources by a user. The PersistentVolumeClaim would then be associated to a Pod resource to provision a PersistentVolume, which would be backed by a Lightbits volume.
An optional volumeMode can be included to select between a mounted file system (default) or raw block device-based volume.
Using the lb-csi-plugin, specifying Filesystem for volumeMode can support ReadWriteOnce accessMode claims, and specifying Block for volumeMode can support ReadWriteOnce accessMode claims.
Filesystem Volume Mode PVC
The file examples/filesystem-workload.yaml provided with the Supplementary Package contains two manifests:
- PVC named
example-fs-pvcreferencingexample-scStorageClass created above. - POD named
example-fs-podbinding toexample-fs-pvc.
Deploying PVC and POD
To deploy the PVC and the POD, run:
kubectl apply -f examples/filesystem-workload.yamlpersistentvolumeclaim/example-fs-pvc createdpod/example-fs-pod createdVerifying Deployment
Using the following command we will see the PV, PVC resources in Bound status and POD in READY state.
kubectl get pv,pvc,podNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEpersistentvolume/pvc-7680be61-0694-44cf-9d1b-1f69827d0b4b 10Gi RWO Delete Bound default/example-fs-pvc example-sc 69sNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEpersistentvolumeclaim/example-fs-pvc Bound pvc-7680be61-0694-44cf-9d1b-1f69827d0b4b 10Gi RWO example-sc 70sNAME READY STATUS RESTARTS AGEpod/example-fs-pod 1/1 Running 0 70sDeleting PVC and POD
kubectl delete -f examples/filesystem-workload.yamlpersistentvolumeclaim "example-fs-pvc" deletedpod "example-fs-pod" deletedBlock Volume Mode PVC
The file examples/block-workload.yaml provided with the Supplementary Package contains two manifests:
- PVC named
example-block-pvcreferencingexample-scStorageClass created above. - POD named
example-block-podbinding toexample-block-pvc.
You can follow the same flow described in the Filesystem Volume Mode PVC section above, to deploy the block volume-mode example.