To let your applications use block storage on a VAST cluster, define a Kubernetes storage class for block storage and reference it in the PVC. Based on the storage class definition, VAST Block CSI Driver will provision a block volume for the PVC using a preconfigured view on the VAST cluster.
Ensure that the following prerequisites are met:
Add a storage class that will be used to provision block volumes. In the storage class definition:
Specify the
block.csi.vastdata.comprovisioner.Add the
subsystemparameter to specify the name of the NVMe subsystem where block volumes will be created. This NVMe subsystem must be associated with a VAST cluster view preconfigured for block storage. If the VAST cluster exposes multiple subsystems that share the same name across VAST tenants, specify thetenantNameoption to for the driver to pick the subsystem associated with the tenant you need.Optionally, define volume naming using the
volumeGroupparameter.Ensure that the virtual IP pool belongs to the same tenant as the VAST cluster's view configured for block storage provisioning.
Tip
For more detailed guidelines, see Creating Block Storage Classes. For more examples, see https://github.com/vast-data/vast-csi/tree/v2.6/examples/block.
For example:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: vastdata-filesystem parameters: csi.storage.k8s.io/controller-expand-secret-name: vast-mgmt csi.storage.k8s.io/controller-expand-secret-namespace: default csi.storage.k8s.io/controller-publish-secret-name: vast-mgmt csi.storage.k8s.io/controller-publish-secret-namespace: default csi.storage.k8s.io/node-publish-secret-name: vast-mgmt csi.storage.k8s.io/node-publish-secret-namespace: default csi.storage.k8s.io/node-stage-secret-name: vast-mgmt csi.storage.k8s.io/node-stage-secret-namespace: default csi.storage.k8s.io/provisioner-secret-name: vast-mgmt csi.storage.k8s.io/provisioner-secret-namespace: default fsType: xfs subsystem: BlockView vip_pool_fqdn: 'MyDomain' volume_group: folder1/folder2/block-{namespace}-{id} provisioner: block.csi.vastdata.com reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: trueCreate a Persistent Volume Claim (PVC) as follows:
Specify the
volumeModeasBlockfor raw block storage orFileSystem(default) for formatted volumes. For more information on volume modes, see Volume Modes.Reference the newly created block storage class in
storageClassName.
For example:
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-raw-block spec: volumeMode: Block accessModes: - ReadWriteOnce resources: requests: storage: 1Gi storageClassName: vast-block-sc
Reference the newly created PVC on the
claimNameparameter in the pod definition.For example:
apiVersion: v1 kind: Pod metadata: name: test-pod spec: containers: - name: app-container image: nginx volumeMounts: - name: data mountPath: /mnt/data volumes: - name: data persistentVolumeClaim: claimName: pvc-raw-block
VAST Cluster Requirements and Preconfigurations
VAST Cluster 5.3 or later is required to provision block volumes.
The VAST cluster must be configured for block storage provisioning as follows:
Block storage support is enabled for the tenant where block volumes will be created.
Under the tenant, there exists a view that exposes the NVMe subsystem where block volumes will be created. The view must have the block storage protocol enabled and the NVMe subsystem defined.
Note
Note that the block storage view is not automatically created by VAST Block CSI Driver. It must be created manually beforehand.
Kubernetes Requirements
A host connecting to block storage must have an NVMe driver installed and configured as needed. This is done outside of VAST Block CSI Driver.
The
nvme-clipackage must be installed on Kubernetes nodes where volumes are to be created.
Volume Modes
VAST Block CSI Driver supports the following volume modes, which can be specified using the volumeMode option in the PVC definition:
Block: A volume is presented to the pod as a raw block device without any filesystem on it.Ephemeral volumes cannot be provisioned in this mode.
Filesystem(default): A volume is formatted using the filesystem type specified in the storage class definition. The following filesystem types are supported:ext4(default),ext3andxfs.In this mode, the volume can be attached to multiple pods simultaneously, but all pods must be scheduled on the same node.