Create Storage Classes
VAST CSI Driver supports multiple Kubernetes storage classes, enabling you to provision multiple storage paths within VAST Cluster, each configured (via VMS) with its own set of access policies, path protection, or replication policies. Each storage class can have its own path, virtual IP pool, a set of mount options, and other parameters.
A storage path is a path within VAST Cluster where VAST CSI Driver will create volume directories. The storage path is specified in the root_export parameter in the YAML configuration file; for example: /a/b/c. (Note that '/' cannot be used as a storage path.) The storage path must be mountable by VAST CSI Driver.
During initial deployment of VAST CSI Driver, you define one or more storage classes in the VAST CSI Driver Helm chart configuration file. Later you can add more storage classes by creating and applying a Kubernetes YAML configuration file.
Add Storage Class
To add a storage class using a Kubernetes YAML configuration file:
-
Create a YAML configuration file that defines a new storage class with the following required parameters:
Note: For a complete list of options that can be specified for a storage class, see Storage Class Option Reference.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <storage class name> provisioner: csi.vastdata.com parameters: vip_pool_fqdn: <virtual IP pool FQDN> | vip_pool_name: <virtual IP pool name> root_export: '/k8s-2' view_policy: 'default' <optional: pairs of secrets and secret namespaces for each volume processing stage>The following example shows creating a storage class named
vastdata-filesystem-2that uses path/k8s-2, view policydefault, and virtual IP pooltest1. The storage class is configured for mTLS authentication.Note: For more examples, see here.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: vastdata-filesystem-2 provisioner: csi.vastdata.com 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 vip_pool_fqdn: 'MyDomain' root_export: '/k8s-2' view_policy: 'default' volume_name_fmt: csi:{namespace}:{name}:{id} mountOptions: - 'xprtsec=mtls' allowVolumeExpansion: true -
Deploy the YAML configuration file:
kubectl apply -f <filename>.yaml -
Verify that the storage class has been added:
kubectl get storageclassesThe output is similar to the following:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE standard (default) k8s.io/minikube-hostpath Delete Immediate false 4d1h vastdata-filesystem (default) csi.vastdata.com Delete Immediate true 58m vastdata-filesystem-2 (default) csi.vastdata.com Delete Immediate true 56m vastdata-filesystem-3 (default) csi.vastdata.com Delete Immediate true 54m
Storage Class Option Reference
You can specify storage class options as follows:
-
In the Helm chart configuration file created for VAST CSI Driver during initial deployment,
-
In a Kubernetes YAML configuration file deployed at a later stage.
-
In VAST CSI Operator's
VastStoragecustom resource definition, when deploying in an OpenShift environment using VAST CSI Operator.
allowVolumeExpansion
(Optional) Determines whether volume expansion is allowed (default, true) or not (false).
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
allowVolumeExpansion: true|false
Syntax for the Kubernetes YAML configuration file:
allow_volume_expansion: true|false
blockingClones
(Optional) Determines whether VAST Block CSI Driver waits for VAST snapshot or clone operations to complete before allowing Kubernetes to proceed with volume provisioning:
-
If true, the driver waits for all snapshot and clone operations to complete before the PVC can be attached to a pod. This ensures that the volume is fully usable and consistent at the time of provisioning, but may add a significant latency.
-
If false (default), the driver proceeds with provisioning right after the snapshot or clone operation is initiated.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
blockingClones: true|false
Syntax for the Kubernetes YAML configuration file:
blocking_clones: true|false
ephemeralVolumeNameFormat
A format string that controls naming of Kubernetes ephemeral volumes created through VAST CSI Driver.
If not specified, the default format csi:{namespace}:{name}:{id} is used.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
ephemeralVolumeNameFormat: "<format>"
Syntax for the Kubernetes YAML configuration file:
eph_volume_name_fmt: "<format>"
mountOptions
Specify NFS mount options for VAST CSI Driver to use when mounting a volume for a PVC with this storage class.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
mountOptions: "<options>"
Syntax for the Kubernetes YAML configuration file:
mount_options: "<options>"
Examples:
mountOptions:
- "proto=rdma"
- "port=20049"
mountOptions:
- debug
- nosuid
- soft
mountOptions:
- nfsvers=4
mountOptions:
- "xprtsec=mtls"
Note: These mount options override host-specific mount options defined through
/etc/nfsmount.conf.d.
qosPolicy
The name of a Quality of Service (QoS) policy to be associated with automatically created views. The QoS policy can be passed either by its name or by its ID (in qos_policy_id).
A QoS policy sets performance limits per view. For more information, see Configure a QoS Policy.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
qosPolicy: "<QoS policy name>"
Syntax for the Kubernetes YAML configuration file:
qos_policy: "<QoS policy name>"
qosPolicyId
The ID of a Quality of Service (QoS) policy to be associated with automatically created views. The QoS policy can be passed either by its ID or by its name (in qos_policy_name).
A QoS policy sets various performance limits per view. For more information, see Configure a QoS Policy.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
qosPolicyId: "<QoS policy ID>"
Syntax for the Kubernetes YAML configuration file:
qos_policy_id: "<QoS policy ID>"
secretName and secretNamespace
These options lets you supply information for communicating with the VAST cluster:
-
<secret name>is the name of the Kubernetes secret that contains information about the VAST cluster on which to provision volumes for this particular storage class, the corresponding VMS user credentials or API token and, optionally, the SSL certificate. For more information, see Provision Volumes on Multiple VAST Clusters. -
<secret namespace>: if the storage class Kubernetes secret was created in a namespace that is different from that used to install the driver's Helm chart, add this parameter to specify the namespace of the Kubernetes secret.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
secretName: "<secret name>"
secretNamespace: "<secret's namespace>"
Syntax for the Kubernetes YAML configuration file:
<pairs of secrets and secret namespaces for each provisioning stage>
If the secret and its namespace are defined as global options in the Helm chart configuration file, they are automatically propagated to each storage class and each provisioning stage therein. In this case, you do not need to explicitly include the per-stage secrets with their corresponding namespaces in the storage class definition.
If no global settings exist for the secret and its namespace, you need to specify them directly in the storage class definition in the following format. Note that you can specify a different value for each stage:
csi.storage.k8s.io/controller-expand-secret-name: <secret name>
csi.storage.k8s.io/controller-expand-secret-namespace: <secret namespace>
csi.storage.k8s.io/controller-publish-secret-name: <secret name>
csi.storage.k8s.io/controller-publish-secret-namespace: <secret namespace>
csi.storage.k8s.io/node-publish-secret-name: <secret name>
csi.storage.k8s.io/node-publish-secret-namespace: <secret namespace>
csi.storage.k8s.io/node-stage-secret-name: <secret name>
csi.storage.k8s.io/node-stage-secret-namespace: <secret namespace>
csi.storage.k8s.io/provisioner-secret-name: <secret name>
csi.storage.k8s.io/provisioner-secret-namespace: <secret namespace>
storagePath
The storage path within VAST Cluster to be used when dynamically provisioning Kubernetes volumes. VAST CSI Driver will automatically create a VAST Cluster view for each volume being provisioned.
Caution: Do not specify '/' as the
<path>.
This option is required when defining a storage class in the Helm chart configuration file.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
storagePath: "<path>"
Syntax for the Kubernetes YAML configuration file:
root_export: "<path>"
viewPolicy
The name of the VAST Cluster view policy to be assigned to VAST Cluster views created by VAST CSI Driver.
A view policy defines access settings for storage exposed through a VAST Cluster view. For more information, see Configure View Policies.
All view policies used with VAST CSI Driver must have the same security flavor.
If you are going to use VAST CSI Driver with VAST Cluster 4.6 or later, a view policy set for a storage class must belong to the same VAST Cluster tenant as the virtual IP pool(s) specified for that storage class.
This option is required when defining a storage class in the Helm chart configuration file.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
viewPolicy: "<policy name>"
Syntax for the Kubernetes YAML configuration file:
view_policy: "<policy name>"
vipPool
The name of the virtual IP pool to be used by VAST CSI Driver. For more information, see Set up Virtual IP Pools.
If you are going to use VAST CSI Driver with VAST Cluster 4.6 or later, a virtual IP pool that you specify for a storage class must belong to the same VAST Cluster tenant as the view policy specified for this storage class.
Either vipPool or vipPoolFQDN option is required when defining a storage class in the Helm chart configuration file. These options are mutually exclusive. When vipPool is used, VAST CSI Driver makes an additional call to the VMS to obtain the IP, which may impact performance when mounting volumes.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
vipPool: "<virtual IP pool name>"
Syntax for the Kubernetes YAML configuration file:
vip_pool_name: "<virtual IP pool name>"
vipPoolFQDN
The domain name of the virtual IP pool to be used by VAST CSI Driver. For more information, see Set up Virtual IP Pools.
Either vipPoolFQDN or vipPool option is required when defining a storage class in the Helm chart configuration file. These options are mutually exclusive. With vipPoolFQDN, the IP for volume mounting is obtained through DNS, which improves mounting times.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
vipPoolFQDN: "virtual IP pool's domain name"
Syntax for the Kubernetes YAML configuration file:
vip_pool_fqdn: "virtual IP pool's domain name"
vipPoolFQDNRandomPrefix
If set to true (default) and the server TLS certificate contains a wildcarded string for the DNS name, the string must match all related virtual IP pools, for example: *.<vippool-dns-domain>.<dns-suffix>.
If the server TLS certificate contains a wildcarded SAN across all virtual IP pools (for example, *.<dns-suffix>), set vip_pool_fqdn_random_prefix to false.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
vipPoolFQDNRandomPrefix: true|false
Syntax for the Kubernetes YAML configuration file:
vip_pool_fqdn_random_prefix: true|false
volumeNameFormat
A format string that controls naming of volumes created through VAST CSI Driver. If not specified, the default format csi:{namespace}:{name}:{id} is used.
Syntax for the Helm chart configuration file and VAST CSI Operator's VastStorage:
volumeNameFormat: "<format>"
Syntax for the Kubernetes YAML configuration file:
volume_name_fmt: "<format>"
Provision Static Volumes
In addition to dynamically creating VAST views for each PVC, VAST CSI Driver can expose existing data as statically provisioned persistent volumes.
You can control whether VAST CSI Driver automatically creates a view and/or a quota for static volumes by leveraging the following options:
-
static_pv_create_views, when set toyes, instructs VAST CSI Driver to create a view for the static volume in case no such view exists. If this option is omitted or set tono, VAST CSI Driver assumes that there is a predefined view on the VAST cluster that can be used for this volume. -
static_pv_create_quotas, when set toyes, instructs VAST CSI Driver to create a quota for the static volume if no quota exists. If this option is omitted or set tono, no quota is created.
These options are specified under volumeAttributes in the csi part of the PV definition YAML. You can enter true or 1 instead of yes as the option value.
Note that VAST CSI Driver does not automatically delete views or quotas it has created, even upon deletion of their respective PVs.
Below is an example of a YAML definition for a statically provisioned persistent volume:
apiVersion: v1
kind: PersistentVolume
metadata:
name: csi-pv-static
spec:
storageClassName: vastdata-filesystem
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
mountOptions:
- nfsvers=3
csi:
driver: csi.vastdata.com
volumeAttributes:
vip_pool_name: vippool-1
view_policy: default
size: 1G
static_pv_create_views: "yes"
static_pv_create_quotas: "yes"
controllerPublishSecretRef:
name: vast-mgmt
namespace: default
volumeHandle: /full/path/to/view
The PVC for a static volume is similar to the following:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc-static
spec:
storageClassName: vastdata-filesystem
volumeName: csi-pv-static
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Provision Ephemeral Volumes
VAST CSI Driver supports Ephemeral Volumes (EVs). You can provision PVCs directly from pod definitions, which are discarded once the pod is terminated.
Specify the volumeAttributes as follows:
-
root_export: as in the storage class definition. -
view_policy: as in the storage class definition. -
vip_pool_name: as in the storage class definition. -
size: as in the PVC.
For example:
apiVersion: v1
kind: Pod
metadata:
name: some-pod
spec:
containers:
- command:
- sh
- -c
- while true; do date -Iseconds >> /shared/$HOSTNAME; sleep 1; done
image: busybox
name: my-frontend
volumeMounts:
- mountPath: /shared
name: my-eph-vol
volumes:
- csi:
driver: csi.vastdata.com
volumeAttributes:
root_export: /k8s
view_policy: default
vip_pool_name: vippool-1
size: 1G
name: my-eph-vol
Provision Volumes on Multiple VAST Clusters
VAST CSI Driver enables you to provision volumes on multiple VAST clusters.
The VAST cluster to use can be specified per storage class, together with the user credentials needed to connect to the VAST cluster. You can also configure multiple storage classes to connect to the same VAST cluster using different user credentials.
If your Kubernetes volumes are protected with VAST Cluster snapshots, you can specify the VAST cluster and user credentials per snapshot class.
Note: Class-specific parameters take precedence over global parameters that apply to all classes.
To configure a storage class or a snapshot class to use a particular combination of a VAST cluster and user credentials:
-
Create a Kubernetes secret that will be used to provision storage on multiple VAST clusters. The secret specifies the following:
-
The hostname of the VAST cluster on which you want to provision volumes
-
The VMS user's username and password
-
If using SSL encryption with a self-signed SSL certificate:
- The SSL certificate to be used to protect the connection
-
If you are creating the secret in a namespace that is different from the namespace used to install the VAST CSI Driver Helm chart:
- The namespace where the secret is created
Note: When provisioning storage on multiple VAST clusters for Kubernetes ephemeral volumes, the namespace where the Kubernetes secret is created must be the same as the namespace where the VAST CSI Driver Helm chart is installed.
-
-
Create a new storage class (or a snapshot class) and supply the newly created secret using the
secretNameparameter of the class.If you have creating the secret in a namespace that is different from the namespace used to install the VAST CSI Driver Helm chart, specify the secret's namespace on the
secretNamespaceparameter.For example:
storageClasses: vastdata-filesystem1: storagePath: /foo viewPolicy: default1 vipPool: vippool1 secretName: vast-mgmt1 secretNamespace: default
If a storage class or a snapshot class does not contain the secretName parameter, VAST CSI Driver uses the information from the secretName and endpoint parameters specified in the VAST CSI Driver Helm chart configuration file (values.yaml) for all storage classes.
Manage NFS Mount Options
NFS mount options that VAST CSI Driver uses when mounting a volume for a PVC can be set as follows:
-
Per storage class
Supply mount options for a particular storage class using the
mountOptionsparameter in the VAST CSI Driver's Helm chart configuration file or themount_optionsparameter in the Kubernetes YAML configuration file. -
Per host
Supply mount options in a host-specific NFS mount configuration file (
.conf) located in the/etc/nfsmount.conf.ddirectory.Note: Ensure that the underlying OS of the worker nodes supports use of the
/etc/nfsmount.conf.ddirectory for setting mount options (seeman nfsmount.conf).
If both storage class-specific and host-specific options are specified, storage class-specific options take precedence.
To make VAST CSI Driver ignore host-specific mount options, set the propagateHostMountOptions parameter to false in the driver's Helm chart configuration file:
node:
propagateHostMountOptions: false
Set Up DNS-Based Virtual IP Resolution
When mounting volumes on the VAST cluster, VAST CSI Driver assigns a virtual IP to each volume being mounted. The virtual IP is taken from one or more virtual IP pools defined on the VAST cluster.
You can control how VAST CSI Driver obtains the IP to use, per storage class:
-
By using DNS to resolve a virtual IP pool's FQDN into an IP. This method is available starting with VAST CSI Driver 2.4.1 to improve performance when mounting volumes.
Specify the FQDN of the virtual IP pool on the
vipPoolFQDNoption in the VAST CSI Driver Helm chart configuration file.Ensure that the VAST cluster has DNS configured, and the virtual IP pool has Virtual IP Pool Domain Name defined in its settings.
-
By making an additional call to VMS to retrieve an IP. This method is used in VAST CSI Driver versions prior to 2.4.1.
Specify the name of the virtual IP pool on the
vipPoolparameter in the VAST CSI Driver Helm chart configuration file.
Either vipPool or vipPoolFQDN option is required when defining a storage class in the Helm chart configuration file. These options are mutually exclusive.