To upgrade your Tanzu Kubernetes Grid instance, you must first upgrade the management cluster. You cannot upgrade Tanzu Kubernetes clusters until you have upgraded the management cluster that manages them.

IMPORTANT: Due to changes in implementation betweeen Tanzu Kubernetes Grid 1.1.x and 1.2, you must upgrade all management clusters that you connect to with the upgraded instance of the Tanzu Kubernetes Grid CLI. You cannot use version 1.2 of the CLI to deploy Tanzu Kubernetes clusters from management clusters that are still at version 1.1.x.

Prerequisites

Procedure

  1. Run the tkg get management-cluster command to see the list of management clusters that you have deployed from your bootstrap machine.

    tkg get management-cluster
    
  2. Run the tkg set management-cluster command to set the context of the Tanzu Kubernetes Grid CLI to the management cluster that you want to upgrade.

    tkg set management-cluster MANAGEMENT-CLUSTER-NAME
    
  3. Run the tkg get cluster command with the --include-management-cluster option.

    tkg get cluster --include-management-cluster
    

    The tkg get cluster command shows the version of Kubernetes that is running in the management cluster and all of the clusters that it manages. For example:

    NAME                NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES          ROLES
    k8s-1-17-11-cluster default     running   1/1           1/1      v1.17.11+vmware.1   <none>
    k8s-1-18-8-cluster  default     running   1/1           1/1      v1.18.8+vmware.1    <none>
    k8s-1-19-1-cluster  default     running   1/1           1/1      v1.19.1+vmware.2    <none> 
    mgmt-cluster        tkg-system  running   1/1           1/1      v1.19.1+vmware.2    <none> 
    
  4. If you are upgrading from Tanzu Kubernetes Grid v1.1.x, add the management label to the management cluster.

    NOTE: In Tanzu Kubernetes Grid 1.2.0 and later, this label is applied to clusters automatically when you create them.

    1. Set the context of kubectl to the management cluster:

      kubectl config use-context MANAGEMENT-CLUSTER-CONTEXT-NAME
      
    2. Apply the management label to the management cluster. The following command applies the management label to mgmt-cluster:

      kubectl label -n tkg-system cluster.cluster.x-k8s.io/mgmt-cluster cluster-role.tkg.tanzu.vmware.com/management="" --overwrite=true
      

      If you have more than one management cluster, add the management label to each of them.

  5. Run the tkg upgrade management-cluster command and enter y to confirm.

    The following command upgrades the management cluster named mgmt-cluster.

     tkg upgrade management-cluster mgmt-cluster 

    If you are upgrading a management cluster that is running on vSphere, and if your vSphere inventory includes more than one base OS template that is running the same version of Kubernetes, specify the --vsphere-vm-template-name option with the name of the template to use to create the cluster.

    NOTE: This is an advanced option that you should not normally need to use. Use this option only when instructed to do so by VMware Tanzu Support.

    tkg upgrade management-cluster mgmt-cluster --vsphere-vm-template-name BASE-OS-TEMPLATE-NAME
    

    To skip the confirmation step when you upgrade a cluster, specify the --yes option.

     tkg upgrade management-cluster mgmt-cluster --yes 

    The upgrade process first upgrades the Cluster API providers for vSphere, Amazon EC2, or Azure that are running in the management cluster. Then, it upgrades the version of Kubernetes in all of the control plane and worker nodes of the management cluster.

    If the upgrade times out before it completes, run tkg upgrade management-cluster again and specify the --timeout option with a value greater than the default of 30 minutes.

     tkg upgrade management-cluster mgmt-cluster --timeout 45m0s 

  6. When the upgrade finishes, run the tkg get cluster command with the --include-management-cluster option again to check that the management cluster has been upgraded.

    tkg get cluster --include-management-cluster
    

    You see that the management cluster is now running the new version of Kubernetes, but that the Tanzu Kubernetes clusters are still running previous versions of Kubernetes.

    NAME                NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES          ROLES
    k8s-1-17-11-cluster default     running   1/1           1/1      v1.17.11+vmware.1   <none> 
    k8s-1-18-8-cluster  default     running   1/1           1/1      v1.18.8+vmware.1    <none> 
    k8s-1-19-1-cluster  default     running   1/1           1/1      v1.19.1+vmware.2    <none> 
    mgmt-cluster        tkg-system  running   1/1           1/1      v1.19.3+vmware.1    management
    

What to Do Next

If your deployment runs on vSphere, you must also perform manual steps to Migrate Clusters from an HA Proxy Load Balancer to Kube-VIP.

You can now upgrade the Tanzu Kubernetes clusters that this management cluster manages. By default, any new clusters that you deploy with this management cluster will run the new default version of Kubernetes. In Tanzu Kubernetes Grid v1.2.1, the default version of Kubernetes is 1.19.3. However, if required, you can use the tkg create cluster command with the --kubernetes-version option to deploy new clusters that run different versions of Kubernetes. For more information, see Deploy a Cluster that Runs a Different Version of Kubernetes.

check-circle-line exclamation-circle-line close-line
Scroll to top icon