You can update a Tanzu Kubernetes cluster by changing the virtual machine class used to host the cluster nodes.

The Tanzu Kubernetes Grid Service supports updating a cluster by changing the VirtualMachineClass definition. If you do this, the service rolls out new nodes with that new class and spins down the old nodes. See About Tanzu Kubernetes Grid Service Cluster Updates.
Note: The VirtualMachineClass must be bound to the vSphere Namespace where the Tanzu Kubernetes cluster is provisioned. See Virtual Machine Classes for Tanzu Kubernetes Clusters.

Prerequisites

This task uses the command kubectl edit tanzukubernetescluster/CLUSTER-NAME to update the cluster manifest. The kubectl edit 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. See Specify a Default Text Editor for Kubectl.

Procedure

  1. Authenticate with the Supervisor Cluster. See Connect to the Supervisor Cluster as a vCenter Single Sign-On User.
    kubectl vsphere login --server=IP-ADDRESS --vsphere-username USERNAME
  2. Switch context to the vSphere Namespace where the target Tanzu Kubernetes cluster is provisioned.
    kubectl config use-context SUPERVISOR-NAMESPACE
  3. Describe the target Tanzu Kubernetes cluster and check the VM class.
    kubectl describe tanzukubernetescluster CLUSTER-NAME
    For example, this cluster is using the best-effort-medium VM class:
    Spec:
      ...
      Topology:
        Control Plane:
          Class:          best-effort-medium
          ...
        Workers:
          Class:          best-effort-medium
          ...
    
  4. List and describe the available VM classes in the namespace.
    kubectl get virtualmachineclassbindings
    Note: The command kubectl get virtualmachineclasses lists all the VM classes present on the Supervisor Cluster. Because you must associate VM classes with the vSphere Namespace, you can only use those VM classes that are bound to the target namespace.
  5. Run the following command to edit the cluster manifest.
    kubectl edit tanzukubernetescluster/CLUSTER-NAME
  6. Edit the manifest by changing the version string and unsetting or nulling out the fullVersion to avoid a potential version mismatch during discovery.
    For example, change the cluster manifest from using the best-effort-medium VM class for control plane and worker nodes:
    spec:
      topology:
        controlPlane:
          class: best-effort-medium
          ...
        workers:
          class: best-effort-medium
          ...
    
    To using the guaranteed-large VM class for control plane and worker nodes:
    spec:
      topology:
        controlPlane:
          class: guaranteed-large
          ...
        workers:
          class: guaranteed-large
          ...
    
  7. 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 Service provisions the new node VMs and spins down the old ones.
  8. 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 Specify a Default Text Editor for Kubectl.
  9. Verify that the cluster is updating.
    kubectl get tanzukubernetescluster
    NAME             CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkgs-cluster-1   3               3        v1.18.5+vmware.1-tkg.1.c40d30d   21h   updating
  10. Verify that the cluster is updated.
    kubectl get tanzukubernetescluster
    NAME             CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkgs-cluster-1   3               3        v1.18.5+vmware.1-tkg.1.c40d30d   22h   running