Raw Block Volume
There are some specialized applications that require direct access to a block device because, for example, the file system layer introduces unneeded overhead. The most common case is databases, which prefer to organize their data directly on the underlying storage. Raw block devices are also commonly used by any software which itself implements some kind of storage service (software defined storage systems).
As it becomes more common to run database software and storage infrastructure software inside of Kubernetes, the need for raw block device support in Kubernetes becomes more important.
To provision the raw block volume, we should create a storageclass without any fstype as Raw block volume does not have any fstype.
Now we can create a pvc with volumeMode as Block to request for a Raw Block Volume :
Now we can deploy the application using the above PVC, the LocalPV-ZFS driver will attach a Raw block device at the given mount path. We can provide the device path using volumeDevices in the application yaml :
As requested by application, a raw block volume will be visible to it at the path /dev/xvda inside the pod.