Deploying Pre-Provisioned Block PV PVC and POD
Follow these steps to statically create a PVC in a new Kubernetes cluster, using the information from the leftover underlying volume.
If you are reusing a volume from another Kubernetes cluster, delete the PVC and PV objects from the old Kubernetes cluster before creating a PV in the new Kubernetes cluster.
Deploying a Block Workload
This chart will create three resources on the cluster:
- PV pointing to the volume on the Lightbits cluster.
- PVC that will bind to this PV (match the size and labels).
- POD that will consume this PVC and will run a simple workload on that volume.
helm install --set preprovisioned.enabled=true \ --set global.storageClass.mgmtEndpoints="10.20.131.24:443\\,10.20.131.2:443\\,10.20.131.6:443\\,192.168.18.96:443\\,192.168.18.99:443\\,192.168.20.24:443" \ --set global.jwtSecret.name="example-secret" \ --set global.jwtSecret.namespace="default" \ --set preprovisioned.lightosVolNguid=0e436046-4bd2-4d71-a55d-8dc1ea33307c \ --set preprovisioned.volumeMode=Block \ --set preprovisioned.storage=1Gi \ lb-csi-preprovisioned-volume \ lightbits-helm-repo/lb-csi-workload-examplesWill output:
NAME: lb-csi-preprovisioned-volumeLAST DEPLOYED: Sun Feb 21 16:09:02 2021NAMESPACE: defaultSTATUS: deployedREVISION: 1TEST SUITE: NoneCreating a PVC that Binds to the New PV
Define the following PVC resource file - pvc.yml:
kindPersistentVolumeClaimapiVersionv1metadata namepre-provisioned-pvcspec accessModesReadWriteOnce resources requests storage1Gi storageClassNameexample-sc volumeModeBlock volumeNameexample-pre-provisioned-pvAnd create this resource:
kubectl create -f pvc.ymlVerifying that the PVC is Bounded to the PV
Verify that 'PV' and 'PVC' are created and in 'Bounded' state, and that 'POD' is in 'Running' state.
x
kubectl get pv,pvc,podsNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASSpv/example-pre-provisioned-pv 1Gi RWO Delete Bound default/example-pre-provisioned-pvc example-scNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASSpvc/example-pre-provisioned-pvc Bound example-pre-provisioned-pv 1Gi RWO example-scNAME READY STATUS RESTARTS AGEpod/example-pre-provisioned-pod 1/1 Running 0 26mDeleting Resources
Delete release:
helm uninstall lb-csi-preprovisioned-volumeVerify that all resources are gone.
kubectl get pv,pvcNo resources found in default namespace.Was this page helpful?