This example shows how to consume a dynamically-provisioned EBS volume as a raw block device.
Make sure the volumeMode is Block.
Edit Application Pod
Make sure the pod is consuming the PVC with the defined name and volumeDevices is used instead of volumeMounts.
kubectl apply -f examples/kubernetes/block-volume/specs/storageclass.yaml
kubectl apply -f examples/kubernetes/block-volume/specs/raw-claim.yaml
kubectl apply -f examples/kubernetes/block-volume/specs/pod.yamlAfter the objects are created, verify that pod is running:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
app 1/1 Running 0 16mVerify the device node is mounted inside the container:
$ kubectl exec -ti app -- ls -al /dev/xvda
brw-rw---- 1 root disk 202, 23296 Mar 12 04:23 /dev/xvdaWrite to the device using:
dd if=/dev/zero of=/dev/xvda bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.0492386 s, 2.1 GB/s