Starting with VMware Cloud Director Container Service Extension 3.1.3, you can optionally configure a default storage class when you create a TKGm cluster and use this storage class when you install applications. This feature automates steps for the tenant users to manage the TKGm cluster for their developers in their organization. This feature is only applicable to TKGm clusters.

Before you create a TKGm cluster, you can configure a default storage class by populating the spec section in the TKGm cluster configuration YAML file. You can configure the following fields in a default storage class:
Table 1. Default Storage Class Configuration Fields
Configuration field Description
filesystem This is set to ext4 by default or xfs.
k8sStorageClassName The name of the storage class.
useDeleteReclaimPolicy If true, the Delete Reclaim policy is used, which deletes the persistent volume when the persistent volume claim is deleted. If false, the Retain Reclaim policy is used, that allows the persistent volume to be manually reclaimed after the persistent volume claim is deleted.
vcdStorageProfileName The VMware Cloud Director storage profile.
Note: If a default storage class is not necessary, it defaults to spec.settings.csi.defaultK8sStorageClass: null.

Procedure

  1. To generate the TKGm cluster configuration file, open vcd-cse and enter the following command:
    vcd cse cluster apply -s --tkg        
    The following code is an example of a TKGm cluster configuration YAML file:
    apiVersion: cse.vmware.com/v2.1
    kind: TKGm
    metadata:
      name: tkgm1
      orgName: org1
      site: https://vcd.com
      virtualDataCenterName: ovdc1
    spec:
      distribution:
        templateName: ubuntu-2004-kube-v1.21.8+vmware.1-tkg.2-ed3c93616a02968be452fe1934a1d37c
        templateRevision: 1
      settings:
        network:
          expose: true
        ovdcNetwork: ovdc1_nw
        rollbackOnFailure: true
        sshKey: 'ssh-key'
        csi:
        - defaultK8sStorageClass:
            filesystem: ext4
            k8sStorageClassName: my-storage-class
            useDeleteReclaimPolicy: true
            vcdStorageProfileName: '*'
      topology:
        controlPlane:
          count: 1
          storageProfile: '*'
        workers:
          count: 1
          storageProfile: '*'
  2. In the spec section of the TKGm cluster configuration file under settings>csi, configure the default storage class to organization requirements.
  3. To apply the default storage class, enter the following command in vcd cse:
    vcd cse cluster apply <tkgm_cluster.yaml>

Results

The TKGm cluster is configured with a default storage class.