Update a Tanzu Kubernetes cluster by upgrading the Tanzu Kubernetes release version.

You can a initiate a rolling update of a Tanzu Kubernetes cluster by upgrading the Tanzu Kubernetes release version. How you do this differs depending on which version of the Tanzu Kubernetes Grid Service API you are using.
TKGS API Version Version Update Method
v1alpha2 API Update the TKR NAME string in the spec.topology.controlPlane.tkr.reference.name and the spec.topology.nodePools[*].tkr.reference.name properties of the cluster manifest. See Updating a Tanzu Kubernetes Release After the Cluster Spec Is Converted to the TKGS v1alpha2 API.
v1alpha1 API Update the DISTRIBUTION version in the spec.distribution.version and spec.distribution.fullVersion properties of the cluster manifest. See below.

Prerequisites

Verify completion of the prequisties for updating Tanzu Kubernetes clusters. See Update Tanzu Kubernetes Clusters.

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. Get the target Tanzu Kubernetes cluster and version.
    kubectl get tanzukubernetescluster
    For example, the result using the TKGS v1alpha2 API:
    kubectl get tanzukubernetescluster
    NAMESPACE        NAME            CONTROL PLANE   WORKER   TKR NAME                             AGE    READY   TKR COMPATIBLE   UPDATES AVAILABLE
    tkgs-cluster-1   test-cluster    3               3        v1.21.2---vmware.1-tkg.1.ee25d55     38h    True    True             [1.21.2+vmware.1-tkg.1.ee25d55]
    For example, the result using the TKGS v1alpha1 API:
    kubectl get tanzukubernetescluster
    NAME             CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkgs-cluster-1   3               3        v1.19.16+vmware.1-tkg.1.df910e2  19h   running
  4. List the available Tanzu Kubernetes releases.
    kubectl get tanzukubernetesreleases
  5. Run the following command to edit the cluster manifest.
    kubectl edit tanzukubernetescluster/CLUSTER-NAME
  6. Edit the manifest by updating Tanzu Kubernetes release. How you do this differs depending on which version of the TKGS API you are using.
    If you are using the TKGS v1alpha2 API, update the TKR NAME string. See Updating a Tanzu Kubernetes Release After the Cluster Spec Is Converted to the TKGS v1alpha2 API.
    If you are using the TKGS v1alpha1 API, update the manifest from, for example:
    spec:
      distribution:
        fullVersion: v1.19.16+vmware.1-tkg.1.df910e2
        version: v1.19.16
    To, for example:
    spec:
      distribution:
        fullVersion: null
        version: v1.20.12
    Note: If you are using the TKGS v1alpha1 API, you can specify the fully qualified version, or use a version shortcut, such as version: v1.20.12, which is resolved to the most recent image matching that patch version, or version: v1.20, which is resolved to the most recent matching patch version. The resolved version displays as the fullVersion in the cluster manifest. To perform a version upgrade using a shortcut, you must unset or null out the fullVersion to avoid a potential version mismatch during discovery.
  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 Virtual Machine Service on the Supervisor Cluster provisions the new worker node.
  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.20.12+vmware.1-tkg.1.b9a42f3  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.20.12+vmware.1-tkg.1.b9a42f3   22h   running