This topic describes how to upgrade management and Tanzu Kubernetes (workload) clusters to Tanzu Kubernetes Grid v1.4 in an internet-restricted Amazon EC2 environment.

This procedure is required for both major (v1.3.x to v1.4.x) and minor (v1.4.x to v1.4.y) upgrades.

IMPORTANT: All clusters use one-year client certificates and upgrading a cluster renews its certificate, so VMware recommends upgrading your clusters at least once a year.

Prerequisites

To upgrade an internet-restricted Tanzu Kubernetes Grid deployment on Amazon EC2 to a v1.4.x, you must have:

  • Tanzu Kubernetes Grid v1.3 or later: You cannot upgrade to Tanzu Kubernetes Grid v1.4 from v1.2 or earlier versions.
    You must first upgrade to a v1.3 as described in Upgrade Tanzu Kubernetes Grid in the Tanzu Kubernetes Grid v1.3 documentation.
  • An internet-connected Linux machine
  • An offline Linux machine
  • Tanzu CLI v1.4 with compatible plugins and kubectl installed on both Linux machines. See Install the CLI and Other Tools.
    • Run tanzu version to check that you are running a v1.4 version of tanzu.
    • Run kubectl version to check that you are running the kubectl version listed in the Tanzu Kubernetes Grid downloads page for your v1.4.x version.
    • Run tanzu plugin list to confirm v1.4 versions of the plugins management-cluster, cluster, login, kubernetes-release, package, and pinniped-auth.
    • For the offline machine, download, transfer, and install the Tanzu CLI bundle and other software following your usual process for that machine.

Step 1: Copy the Images

From your internet-connected machine, copy the container images used by Tanzu Kubernetes Grid into your offline registry. The procedure depends on whether your offline environment is proxied or physically airgapped.

  • Proxied environment:

    1. Run the gen-publish-images.sh script by following Step 2: Generate the publish-images Script in the Prepare an Internet-Restricted Environment topic.

      • The gen-publish-images.sh script generates a publish-images.sh script from the latest Bill of Materials (BoM) files.
      • If you have a publish-images.sh file from a previous deployment, you must still run gen-publish-images.sh to regenerate publish-images.sh to that it includes the latest component versions.
    2. Run the publish-images.sh script by following Step 3: Run the publish-images Script in the Prepare an Internet-Restricted Environment topic.

      • Running publish-images.sh pulls the correct component versions for your Tanzu Kubernetes Grid version and saves them to your local private Docker registry.
  • Physically airgapped environment:

Step 2: Upgrade Management Clusters

To upgrade Tanzu Kubernetes Grid, you must first upgrade all management clusters in your deployment. You cannot upgrade workload clusters until you have upgraded their management clusters. Follow the procedure below to upgrade the management clusters.

  1. Run the tanzu login command to see an interactive list of management clusters available for upgrade.

  2. Select the management cluster that you want to upgrade. See List Management Clusters and Change Context for more information.

    tanzu login --kubeconfig /root/.kube/config --context mgmt-cluster@mgmt-cluster --name mgmt-cluster
    
  3. Run the tanzu cluster list command with the --include-management-cluster option.

    tanzu cluster list --include-management-cluster
    

    This command shows the versions of Kubernetes running on the management cluster and all of the clusters that it manages:

    $ tanzu cluster list --include-management-cluster
     NAME                 NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES         ROLES       PLAN
     k8s-1-19-12-cluster   default     running   1/1           1/1      v1.19.12+vmware.1   <none>      dev
     k8s-1-20-5-cluster   default     running   1/1           1/1      v1.20.5+vmware.1   <none>      dev
     mgmt-cluster         tkg-system  running   1/1           1/1      v1.21.2+vmware.1   management  dev
    
  4. Set the following environment variables so the Tanzu CLI can access your private image registry and know which region and zone to deploy to. Find the access key settings in your ~/.aws/config file.

     export TKG_CUSTOM_IMAGE_REPOSITORY=
     export TKG_CUSTOM_IMAGE_REPOSITORY_CA_CERTIFICATE=
     export AWS_REGION=
     export AWS_NODE_AZ=
     export AWS_ACCESS_KEY_ID=
     export AWS_SECRET_ACCESS_KEY=
     export AWS_SSH_KEY_NAME=
    
  5. Run the tanzu management-cluster upgrade command and enter y to confirm.

    The following command upgrades the current management cluster.

    tanzu management-cluster upgrade
    

    If multiple base VM images in your IaaS account have the same version of Kubernetes that you are upgrading to, use the --os-name option to specify the OS you want. See Selecting an OS During Cluster Upgrade for more information.

    For example, on vSphere if you have uploaded both Photon and Ubuntu OVA templates with Kubernetes v1.21.2, specify --os-name ubuntu to upgrade your management cluster to run on an Ubuntu VM.

    tanzu management-cluster upgrade --os-name ubuntu
    

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

    tanzu management-cluster upgrade --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 tanzu management-cluster upgrade again and specify the --timeout option with a value greater than the default of 30 minutes.

    tanzu management-cluster upgrade --timeout 45m0s
    

    IMPORTANT: Tanzu Kubernetes Grid v1.3.x stored cluster configuration and CLI state information in the ~/.tanzu folder. v1.4.x stores this information in ~/.config/tanzu. Running tanzu management-cluster upgrade migrates the information from ~/.tanzu to ~/.config/tanzu.

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

    tanzu cluster list --include-management-cluster
    

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

     NAME                 NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES         ROLES       PLAN
     k8s-1-19-12-cluster   default     running   1/1           1/1      v1.19.12+vmware.1   <none>      dev
     k8s-1-20-5-cluster   default     running   1/1           1/1      v1.20.5+vmware.1   <none>      dev
     mgmt-cluster         tkg-system  running   1/1           1/1
     v1.21.2+vmware.1   management  dev
    
  7. Run tanzu config server list to confirm that all management cluster configurations have migrated into the ~/.config/tanzu. After confirmation, you can delete the ~/.tanzu folder.

Step 3: Upgrade Workload Clusters

After you upgrade the management clusters in your deployment, you can upgrade the workload clusters that are managed by those management clusters.

Follow the procedure below to upgrade the workload clusters that are running your workloads.

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

  1. Run the tanzu login command to see an interactive list of available management clusters.

  2. Select a management cluster to switch the context of the Tanzu CLI to the management cluster that manages the clusters you want to upgrade. See List Management Clusters and Change Context for more information.

    tanzu login --kubeconfig /root/.kube/config --context mgmt-cluster@mgmt-cluster --name mgmt-cluster
    
  3. Run the tanzu cluster list command with the --include-management-cluster option.

    tanzu cluster list --include-management-cluster
    

    The tanzu cluster list 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 v1.21.2, but the workload clusters are running older versions of Kubernetes.

     NAME                 NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES         ROLES       PLAN
     k8s-1-19-12-cluster   default     running   1/1           1/1      v1.19.12+vmware.1   <none>      dev
     k8s-1-20-8-cluster   default     running   1/1           1/1      v1.20.8+vmware.1   <none>      dev
     mgmt-cluster         tkg-system  running   1/1           1/1
     v1.21.2+vmware.1   management  dev
    
  4. To discover which versions of Kubernetes are made available by a management cluster, run the tanzu kubernetes-release get command.

    tanzu kubernetes-release get
    

    The output lists all of the versions of Kubernetes that you can use to deploy clusters, with the following notes: - COMPATIBLE: The current management cluster can deploy workload clusters with this Tanzu Kubernetes release (tkr). - UPGRADEAVAILABLE: This tkr is not the most current in its Kubernetes version line. Any workload clusters running this tkr version can be upgraded to newer versions.

    For example:

     NAME                       VERSION                  COMPATIBLE  UPGRADEAVAILABLE
     v1.19.12---vmware.1-tkg.1  v1.19.12+vmware.1-tkg.1  True        True
     v1.1.20.5---vmware.1-tkg.1   v1.1.20.5+vmware.1-tkg.1   True        True
     v1.20.8---vmware.1-tkg.1   v1.20.8+vmware.1-tkg.1   True        True
     v1.21.2---vmware.1-tkg.1   v1.21.2+vmware.1-tkg.1   True        False
    
  5. To discover the newer tkr versions to which you can upgrade a workload cluster running an older tkr version, run the tanzu kubernetes-release available-upgrades get command, specifying the current version of the cluster.

    tanzu kubernetes-release available-upgrades get v1.19.8---vmware.1-tkg.1
    

    This command lists all of the available Kubernetes versions to which you can upgrade clusters that are running the specified version.

    NAME                      VERSION
    v1.19.12---vmware.1-tkg.1 v1.19.12+vmware.1-tkg.1
    v1.20.8---vmware.1-tkg.1  v1.20.8+vmware.1-tkg.1
    

    You can also discover the tkr versions that are available for a specific workload cluster by specifying the cluster name in the tanzu cluster available-upgrades get command.

    tanzu cluster available-upgrades get <cluster_name>
    

    This command lists all of the Kubernetes versions that are compatible with the specified cluster.

    NAME                         VERSION                            COMPATIBLE
    v1.20.7---vmware.1-tkg.1     v1.20.7+vmware.1-tkg.1             False
    v1.20.7---vmware.1-tkg.1     v1.20.7+vmware.1-tkg.1-zshippable  False
    v1.20.8---vmware.1-tkg.1     v1.20.8+vmware.1-tkg.1-zshippable  False
    v1.20.8---vmware.1-tkg.2     v1.20.8+vmware.1-tkg.2-zshippable  True
    v1.21.2---vmware.1-tkg.1     v1.21.2+vmware.1-tkg.1-zshippable  True
    

    You cannot skip minor versions when upgrading your tkr version. For example, you cannot upgrade a cluster directly from v1.19.x to v1.21.x. You must upgrade a v1.19.x cluster to v1.20.x before upgrading the cluster to v1.21.x. Ensure that you have copied the required images to your private registry for the selected tkr version using publish-images.sh script before upgrading the tanzu cluster.

  6. Run the tanzu cluster upgrade CLUSTER-NAME 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 tanzu cluster upgrade command without any options. For example, the following command upgrades the cluster k8s-1-20-5-cluster from v1.20.5 to v1.21.2.

    tanzu cluster upgrade k8s-1-20-5-cluster
    

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

    tanzu cluster upgrade CLUSTER-NAME --namespace NAMESPACE-NAME
    

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

    tanzu cluster upgrade CLUSTER-NAME --yes
    

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

    tanzu cluster upgrade CLUSTER-NAME --timeout 45m0s
    

    If multiple base VM images in your IaaS account have the same version of Kubernetes that you are upgrading to, use the --os-name option to specify the OS you want. See Selecting an OS During Cluster Upgrade for more information.

    For example, on vSphere if you have uploaded both Photon and Ubuntu OVA templates with Kubernetes v1.21.2, specify --os-name ubuntu to upgrade your workload cluster to run on an Ubuntu VM.

    tanzu cluster upgrade CLUSTER-NAME --os-name ubuntu
    

    Since you cannot skip minor versions of tkr, the upgrade command fails if you try to upgrade a cluster that is more than one minor version behind the default version. For example, you cannot upgrade directly from v1.19.x to v1.21.x. To upgrade a cluster to a version of Kubernetes that is not the default version for this release of Tanzu Kubernetes Grid, specify the --tkr option with the NAME of the chosen version, as listed by tanzu kubernetes-release get above. For example, to upgrade the cluster k8s-1-19-12-cluster from v1.19.12 to v1.20.8.

    tanzu cluster upgrade k8s-1-19-9-cluster --tkr v1.20.8---vmware.1-tkg.1 --yes
    
  7. When the upgrade finishes, run the tanzu cluster list command with the --include-management-cluster option again, to check that the workload cluster has been upgraded.

    tanzu cluster list --include-management-cluster
    

    You see that the k8s-1-19-9-cluster and k8s-1-20-5-cluster workload clusters are now running Kubernetes v1.20.8 and v1.21.2 respectively.

     NAME                 NAMESPACE   STATUS    CONTROLPLANE  WORKERS  KUBERNETES         ROLES       PLAN
     k8s-1-18-17-cluster  default     running   1/1           1/1      v1.18.17+vmware.1  <none>      dev
     k8s-1-19-9-cluster   default     running   1/1           1/1      v1.20.8+vmware.1   <none>      dev
     k8s-1-20-5-cluster   default     running   1/1           1/1      v1.21.2+vmware.1   <none>      dev
     mgmt-cluster         tkg-system  running   1/1           1/1
     v1.21.2+vmware.1   management  dev
    

What to Do Next

You can now continue to use the Tanzu CLI to manage your clusters and run your applications with the new version of Kubernetes in your internet-restricted environment.

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