Update a Tanzu Kubernetes cluster by upgrading the Kubernetes version.

You can update a Tanzu Kubernetes cluster by upgrading the Kubernetes version. To do this, change the distribution version for the cluster in the .spec.distribution.version and .spec.distribution.fullVersion properties of the cluster manifest.

Prerequisites

Refer to the list of supported Tanzu Kubernetes Releases for version compatibility and upgrade recommendations. See Supported Update Path.

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 Supervisor 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:
    kubectl get tanzukubernetescluster
    NAME             CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkgs-cluster-1   3               3        v1.17.8+vmware.1-tkg.1.5417466   19h   running
  4. List the available Tanzu Kubernetes versions by running either of the following commands.
    kubectl get tanzukubernetesreleases
    kubectl get virtualmachineimages
    In this example scenario we upgrade a Tanzu Kubernetes cluster from v1.17.8 to v1.18.5.
  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 manifest from the following:
    spec:
      distribution:
        fullVersion: v1.17.8+vmware.1-tkg.1.5417466
        version: v1.17.8
    To the following:
    spec:
      distribution:
        fullVersion: null
        version: v1.18.5
  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.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