vSphere Container Storage Plug-in supports block based volumes, also called raw block volumes. You can use this functionality to expose a persistent volume inside a container as a block device rather than a mounted file system.
For information about raw block volume support in Kubernetes, see Raw Block Volume Support.
Certain applications require a direct access to a block device. When using a raw block device without a file system, Kubernetes can provide a better support to high-performance applications that are capable of consuming and manipulating block storage for their needs. Such applications as MongoDB and Cassandra that require consistent I/O performance and low latency can benefit from the raw block volumes technology and organize their data directly on the underlying storage.
Requirements
- Use vSphere Container Storage Plug-in version 3 or later.
- Use only single-access
ReadWriteOnce
raw block volumes. vSphere Container Storage Plug-in does not support raw block volume that use theReadWriteMany
access mode.
Create a Raw Block PVC
Follow this procedure to create a new raw block PVC.
Procedure
Use a Raw Block PVC
When you use the PVC in a pod definition, you must specify the device path for the block device rather than the mount path for the file system.
Procedure
- ♦ Use the following example.
apiVersion: v1 kind: Pod metadata: name: example-raw-block-pod spec: containers: - name: test-container image: gcr.io/google_containers/busybox:1.24 command: ["/bin/sh", "-c", "while true ; do sleep 2 ; done"] volumeDevices: - devicePath: /dev/xvda name: data restartPolicy: Never volumes: - name: data persistentVolumeClaim: claimName: example-raw-block-pvc