For workloads requiring persistence, you can use the default storage class, or define your own storage class for use with persistent volumes. Tanzu Kubernetes clusters support the Container Storage Interface (CSI) provisioner.
Container Storage Interface (CSI) Is Supported
Tanzu Kubernetes clusters support the Container Storage Interface (CSI). In the StorageClass
definition, this type of provisioner is identified as csi.vsphere.vware.com
.
The following YAML definition can be used as a template to define a storage class for a
Tanzu Kubernetes cluster. Specify if you want the storage class to be the default ("true"), and provide the datastore URL for your storage environment.
kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: tkgs-storage-class annotations: storageclass.kubernetes.io/is-default-class: "true" or "false" provisioner: csi.vsphere.vmware.com parameters: datastoreurl: "ds:///vmfs/volumes/vsan:52d8eb4842dbf493-41523be9cd4ff7b7/"
Create the storage class:
kubectl apply -f tkgs-storage-class.yaml storageclass.storage.k8s.io/tkgs-storage-class created
Verify that the storage class is created:
kubectl get storageclass
Or, using the shortcut:
kubectl get sc
VMware Cloud Provider (vCP) Is Not Supported
Tanzu Kubernetes clusters do not support the legacy VMware Cloud Provider (vCP)
StorageClass
as shown below. If you attempt to create a
StorageClass
using the vCP provisioner, the
StorageClass
is not created.
kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: demo-sts-sc provisioner: kubernetes.io/vsphere-volume parameters: diskformat: thin