You can update a TKG cluster by changing the storage class used by the cluster nodes.

You can a initiate a rolling update of a TKG 2.0 cluster by editing the value of the storageClass parameter in the cluster specificiation using the kubectl edit command.
Note: You cannot use the kubectl apply command to update a deployed TKG cluster.

Prerequisites

This task requires the use of the kubectl edit command. This command opens the cluster manifest in the text editor defined by your KUBE_EDITOR or EDITOR environment variable. When you save the file, the cluster is updated with the changes. To configure an editor for kubectl, see Configure a Text Editor for Kubectl.

Procedure

  1. Authenticate with the Supervisor.
    kubectl vsphere login --server=IP-ADDRESS --vsphere-username USERNAME
  2. Switch context to the vSphere Namespace where the target workload cluster is provisioned.
    kubectl config use-context SUPERVISOR-NAMESPACE
  3. To determine available storage classes and decide which to use, run the following command.
    kubectl describe tanzukubernetescluster CLUSTER-NAME
  4. Run the following command to edit the cluster manifest.
    v1alpha3 cluster:
    kubectl edit tanzukubernetescluster/CLUSTER-NAME
    v1beta1 cluster:
    kubectl edit cluster/CLUSTER-NAME
  5. Edit the manifest by changing the storageClass value.
    For example, for a v1alpaha3 cluster, change the cluster manifest from the silver-storage-class class for control plane and worker nodes:
    spec:
      topology:
        controlPlane:
          ...
          storageClass: silver-storage-class
        workers:
          ...      
          storageClass: silver-storage-class
    To the gold-storage-class class for control plane and worker nodes:
    spec:
      topology:
        controlPlane:
          ...
          storageClass: gold-storage-class
        workers:
          ...      
          storageClass: gold-storage-class
    Similarly, if you have provisioned a v1beta1 cluster, update the variables.storageclass value in the cluster specification with the name of the storage class.
  6. Save the changes you made to the manifest file.
    When you save the file, kubectl applies the changes to the cluster. In the background, the Tanzu Kubernetes Grid provisions the new node VMs and spins down the old ones.
  7. Verify that kubectl reports that the manifest edits were successfully recorded.
    kubectl edit tanzukubernetescluster/tkgs-cluster-1
    tanzukubernetescluster.run.tanzu.vmware.com/tkgs-cluster-1 edited
    Note: If you receive an error, or kubectl does not report that the cluster manifest was successfully edited, make sure you have properly configured your default text editor using the KUBE_EDITOR environment variable. See Configure a Text Editor for Kubectl.
  8. Verify that the cluster is updated.
    v1alpha3 cluster:
    kubectl get tanzukubernetescluster
    v1beta1 cluster:
    kubectl get cluster