This quick start guide walks you through creating a BlockVolume using the NVMesh CSI Driver and using this volume from a POD.
Prerequisite
Before you continue, please make sure you have already Installed and Configured your NVMesh CSI Driver on your cluster.
Create a PVC
Create a volume using the following PVC yaml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: block-pvc
spec:
accessModes:
- ReadWriteMany
volumeMode: Block
resources:
requests:
storage: 5Gi
storageClassName: nvmesh-concatenated
Run the following command and check the output to make sure your volume was created successfully:
$kubectl get pvc
NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
default block-pvc Bound pvc-2ec86fdd-f656-4810-9a03-54fcd668a705 5Gi RWX nvmesh-concatenated 2s
Go to your NVMesh-Managment GUI. You should be able to see that a new volume was created.
Create a POD
Create a POD using the following PVC yaml:
apiVersion: v1
kind: Pod
metadata:
name: block-volume-consumer-pod
labels:
app: block-volume-consumer-test
spec:
containers:
- name: block-volume-consumer
image: excelero/qguide_block_volume_consumer
args: ["/dev/my_block_dev"]
volumeDevices:
- name: block-volume
devicePath: /dev/my_block_dev
volumes:
- name: block-volume
persistentVolumeClaim:
claimName: block-pvc
Run the following command. Check the output to make sure your pod was created successfully:
$ kubectl get pod block-volume-consumer-pod
NAME READY STATUS RESTARTS AGE
block-volume-consumer-pod 1/1 Running 0 20s
Check the logs:
$ kubectl logs block-volume-consumer-pod
Writing to file /dev/my_block_dev
Read 15 bytes: "Excelero NVMesh"
- Sleeping
- Sleeping
The following indicates that the Container in the pod had successfully written and read from the block device /dev/my_block_dev
For more examples, go to Usage Examples.
Post your comment on this topic.