check-circle-line exclamation-circle-line close-line

<

After you have upgraded a management cluster, you can upgrade the Tanzu Kubernetes clusters that the management cluster manages.

Prerequisites

  • You performed the steps in Upgrading Tanzu Kubernetes Grid to upgrade the Tanzu Kubernetes Grid CLI.
  • You performed the steps in Upgrade Management Clusters to upgrade the management cluster that manages the Tanzu Kubernetes clusters that you want to upgrade.
  • If you are upgrading clusters that run on vSphere, before you can upgrade clusters to a non-default version of Kubernetes for your version of Tanzu Kubernetes Grid, the appropriate base OS template OVAs must be available in vSphere as VM templates. For information about importing base OVA files into vSphere, see Import the Base Image Template into vSphere.
  • If you are upgrading clusters that run in Amazon EC2, the Amazon Linux 2 Amazon Machine Images (AMI) that include the supported Kubernetes versions are publicly available to all Amazon EC2 users, in all supported AWS regions. Tanzu Kubernetes Grid automatically uses the appropriate AMI for the Kubernetes version that you specify during upgrade.

Procedure

The upgrade process upgrades the version of Kubernetes in all of the control plane and worker nodes of your Tanzu Kubernetes clusters.

  1. Run the tkg get management-cluster command to see the list of management clusters that you have deployed from your bootstrap environment 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 manages the clusters 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. In this example, you can see that the management cluster has already been upgraded to version 1.18.3, but the Tanzu Kubernetes clusters are running older versions of Kubernetes.

    NAME                NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES       
    k8s-1-17-3-cluster  default     running   1/1           1/1      v1.17.3+vmware.2 
    k8s-1-17-6-cluster  default     running   1/1           1/1      v1.17.6+vmware.1 
    k8s-1-18-2-cluster  default     running   1/1           1/1      v1.18.2+vmware.1 
    mgmt-cluster        tkg-system  running   1/1           1/1      v1.18.3+vmware.1 
    
  4. Run the tkg upgrade cluster command and enter y to confirm.

    To upgrade the cluster to the default version of Kubernetes for this release of Tanzu Kubernetes Grid, run the tkg upgrade cluster command without any options. For example, the following command upgrades the cluster k8s-1-18-2-cluster from v1.18.2 to v1.18.3.

    tkg upgrade cluster k8s-1-18-2-cluster
    

    If the cluster is not running in the default namespace, specify the --namespace option.

     tkg upgrade cluster cluster_name --namespace namespace_name 

    If you are upgrading a 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 --vpshere-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 cluster cluster_name --vpshere-vm-template-name baseos_template_name 

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

     tkg upgrade cluster cluster_name --yes 

    To upgrade a cluster to a version of Kubernetes that is not the default version for this release of Tanzu Kubernetes Grid, specify the --kubernetes-version option. For example, the following command upgrades the cluster k8s-1-17-3-cluster from v1.17.3 to v1.17.6.

    tkg upgrade cluster k8s-1-17-3-cluster --kubernetes-version v1.17.6 --yes
    

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

     tkg upgrade cluster cluster_name --timeout 45m0s 

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

    tkg get cluster --include-management-cluster
    

    You see that the k8s-1-17-3-cluster and k8s-1-18-2-cluster Tanzu Kubernetes clusters are now running Kubernetes v1.17.6 and v1.18.3 respectively.

    NAME                NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES
    k8s-1-17-3-cluster  default     running  1/1           1/1      v1.17.6+vmware.1 
    k8s-1-17-6-cluster  default     running  1/1           1/1      v1.17.6+vmware.1 
    k8s-1-18-2-cluster  default     running  1/1           1/1      v1.18.3+vmware.1 
    mgmt-cluster        tkg-system  running  1/1           1/1      v1.18.3+vmware.1 
    

What to Do Next

You can continue to use Tanzu Kubernetes Grid CLI to manage your clusters, and run your applications with the new version of Kubernetes.