Installing a Default Storage Class

This topic describes how to install a default storage class on your Kubernetes clusters to support Tanzu Application Service for Kubernetes (TAS for Kubernetes).

Note: If your Kubernetes cluster already comes with a default storage class, skip this procedure. See Verify that a Default Storage Class Exists in Preparing the Kubernetes Cluster.

Overview

Installing a default storage class on your Kubernetes clusters enables dynamic provisioning of persistent volumes.

You can install a default storage class on Kubernetes clusters that are provisioned by Tanzu Kubernetes Grid Integrated Edition (TKGI) on vSphere or provisioned by Tanzu Kubernetes Grid (TKG) on vSphere or Amazon Web Services (AWS).

See the following sections:

Install a Default Storage Class for TKGI-Provisioned Clusters on vSphere

To install a default storage class for a TKGI-provisioned cluster on vSphere:

  1. Create a file named vsphere-default-storage-class.yml.
  2. Populate the vsphere-default-storage-class.yml file with the following:

    ---
    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: thin
      annotations:
        storageclass.kubernetes.io/is-default-class: "true"
    provisioner: kubernetes.io/vsphere-volume
    
  3. To install the StorageClass, run the following command:

    kapp deploy -a default-storage-class -f vsphere-default-storage-class.yml
    

For more information and additional requirements, see Provision a Dynamic PV in Configuring and Using PersistentVolumes in the TKGI documentation.

Install a Default Storage Class for TKG-Provisioned Clusters on vSphere

To install a default storage class for a TKG-provisioned cluster on vSphere:

  1. Create a file named vsphere-default-storage-class.yml.
  2. Populate the vsphere-default-storage-class.yml file with the following:

    ---
    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: thin-csi
      annotations:
        storageclass.kubernetes.io/is-default-class: "true"
    provisioner: csi.vsphere.vmware.com
    parameters:
      datastoreurl: "DATASTORE-URL"
    

    Where DATASTORE-URL is the URL to your CSI datastore.

  3. To install the StorageClass, run:

    kapp deploy -a default-storage-class -f vsphere-default-storage-class.yml
    

Install a Default Storage Class for TKG-Provisioned Clusters on AWS

To install a default storage class for a TKG-provisioned cluster on AWS:

  1. Create a file named aws-default-storage-class.yml.
  2. Populate the aws-default-storage-class.yml file with the following:

      ---
      kind: StorageClass
      apiVersion: storage.k8s.io/v1
      metadata:
        name: gp2
        annotations:
          storageclass.kubernetes.io/is-default-class: "true"
      provisioner: kubernetes.io/aws-ebs
      parameters:
        type: gp2
        fsType: ext4
    
  3. To install the StorageClass, run:

    kapp deploy -a default-storage-class -f aws-default-storage-class.yml
    
  4. To verify that there is a storage class marked with (default) in your StorageClass list:

    kubectl get storageclass
    

Next Steps

After you complete this procedure, proceed to Configuring Installation Values.