How to Upgrade VMware TKG 1.2.0 to 1.2.1

In the previous blog posts we discussed about the prerequisites and different steps involved in installing the TKGm 1.2.0 version on vSphere. In this blog post, we will try to upgrade the TKG to 1.2.1 which is the latest one available at the time of writing this blog.

Current environment:

Let’s check the version of TKG running currently by running tkg version command

ubuntu@cli-vm:~$ tkg version
Client:
        Version: v1.2.0
        Git commit: 05b233e75d6e40659247a67750b3e998c2d990a5

Let’s check the number of clusters running in the current TKG environment by running tkg get clusters. You can also add the –include-management-cluster switch to display the management cluster as well. Make a note of the KUBERNETES version which is v1.19.1+vmware.2 running on the vsphere-workload-1 and the management cluster.

ubuntu@cli-vm:~$ tkg get cluster --include-management-cluster
 NAME                             NAMESPACE   STATUS   CONTROLPLANE  WORKERS  KUBERNETES        ROLES
vsphere-workload-1               default     running  1/1           1/1      v1.19.1+vmware.2  <none>
tkg-mgmt-vsphere-20210129224846  tkg-system  running  1/1           1/1      v1.19.1+vmware.2  management

Prepare for TKG upgrade:

Download TKG 1.2.1:

Lets now go to VMware Customer Connect(previous known as myvmware) and download the TKG 1.2.1 product. Make sure to download at least the below listed packages from the download page.

  • VMware Tanzu Kubernetes Grid 1.2.1 CLI
  • Photon v3 Kubernetes v1.19.3 OVA
  • Kubectl 1.19.3 for VMware Tanzu Kubernetes Grid 1.2.1

Upgrade TKG and Kubectl Cli:

In order to upgrade, we just have to replace the old TKG and Kubectl Cli with the new version that is downloaded from TKG 1.2.1 download page. Once the required packages are downloaded, follow the steps I shared in this blog post and install TKG and Kubectl.

Let’s check the TKG and Kubectl version once again to confirm it is in version 1.2.1.

ubuntu@cli-vm:~$ tkg version
Client:
        Version: v1.2.1
        Git commit: 9d15a485f2ccc462622f8df6a81e5fa831c51895
ubuntu@cli-vm:~$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3+vmware.1", GitCommit:"2ac9e7ea06a1230ca196931def19d2bb67b580c7", GitTreeState:"clean", BuildDate:"2020-11-17T00:11:18Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.1+vmware.2", GitCommit:"9d9a7637ad75801f9296a1cebe63120c020305d4", GitTreeState:"clean", BuildDate:"2020-09-22T22:55:02Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}

Also make sure to deploy the Photon v3 Kubernetes v1.19.3 OVA in your vSphere environment as a virtual machine and convert it to a template. The steps are already discussed in this blog post. Repeat the procedure for each of the Kubernetes versions for which you have downloaded the OVA file.

Upgrade TKG Management cluster:

First step with upgrading the TKG cluster is to upgrade the management cluster. To upgrade the management cluster, run the below command.

tkg upgrade management-cluster <management-cluster-name> --config .tkg/config.yaml
ubuntu@cli-vm:~$ tkg upgrade management-cluster tkg-mgmt-vsphere-20210129224846 --config .tkg/config.yaml
Logs of the command execution can also be found at: /tmp/tkg-20210224T000748608913950.log
Upgrading management cluster 'tkg-mgmt-vsphere-20210129224846' to TKG version 'v1.2.1' with Kubernetes version 'v1.19.3+vmware.1'. Are you sure? [y/N]: y
Upgrading management cluster providers...
Checking cert-manager version...
Cert-manager is already up to date
Performing upgrade...
Deleting Provider="cluster-api" Version="" TargetNamespace="capi-system"
Installing Provider="cluster-api" Version="v0.3.11" TargetNamespace="capi-system"
Deleting Provider="bootstrap-kubeadm" Version="" TargetNamespace="capi-kubeadm-bootstrap-system"
Installing Provider="bootstrap-kubeadm" Version="v0.3.11" TargetNamespace="capi-kubeadm-bootstrap-system"
Deleting Provider="control-plane-kubeadm" Version="" TargetNamespace="capi-kubeadm-control-plane-system"
Installing Provider="control-plane-kubeadm" Version="v0.3.11" TargetNamespace="capi-kubeadm-control-plane-system"
Deleting Provider="infrastructure-vsphere" Version="" TargetNamespace="capv-system"
Installing Provider="infrastructure-vsphere" Version="v0.7.1" TargetNamespace="capv-system"
Management cluster providers upgraded successfully...
Upgrading management cluster kubernetes version...
Verifying kubernetes version...
Retrieving configuration for upgrade cluster...
consuming Azure VM image information from BOM
Create InfrastructureTemplate for upgrade...
Upgrading control plane nodes...
Patching KubeadmControlPlane with the kubernetes version v1.19.3+vmware.1...
Waiting for kubernetes version to be updated for control plane nodes
Upgrading worker nodes...
Patching MachineDeployment with the kubernetes version v1.19.3+vmware.1...
Waiting for kubernetes version to be updated for worker nodes...
Management cluster 'tkg-mgmt-vsphere-20210129224846' successfully upgraded to TKG version 'v1.2.1' with kubernetes version 'v1.19.3+vmware.1'

You can also review the log at /tmp/tkg-20210224T000748608913950.log from the above command output to see the detailed messages during the upgrade process. Now, let’s run the below command and check the management cluster that we just upgraded.

tkg get cluster --include-management-cluster 
ubuntu@cli-vm:~$ tkg get cluster --include-management-cluster
 NAME                             NAMESPACE   STATUS   CONTROLPLANE  WORKERS  KUBERNETES        ROLES
 vsphere-workload-1               default     running  1/1           1/1      v1.19.1+vmware.2  <none>
 tkg-mgmt-vsphere-20210129224846  tkg-system  running  1/1           1/1      v1.19.3+vmware.1  management

Now we see that the management cluster is upgraded and the KUBERNETES version is changed to v1.19.3+vmware.1

Upgrade TKG Workload cluster:

Once the management cluster upgrade is completed successfully, we can proceed with the workload cluster upgrades. To upgrade the TKG workload cluster, run the below command

tkg upgrade cluster <workload-cluster-name>
ubuntu@cli-vm:~$ tkg upgrade cluster vsphere-workload-1
Logs of the command execution can also be found at: /tmp/tkg-20210224T010752143237754.log
Upgrading workload cluster 'vsphere-workload-1' to kubernetes version 'v1.19.3+vmware.1'. Are you sure? [y/N]: y
Validating configuration...
Verifying kubernetes version...
Retrieving configuration for upgrade cluster...
consuming Azure VM image information from BOM
Create InfrastructureTemplate for upgrade...
Upgrading control plane nodes...
Patching KubeadmControlPlane with the kubernetes version v1.19.3+vmware.1...
Waiting for kubernetes version to be updated for control plane nodes
Upgrading worker nodes...
Patching MachineDeployment with the kubernetes version v1.19.3+vmware.1...
Waiting for kubernetes version to be updated for worker nodes...
Cluster 'vsphere-workload-1' successfully upgraded to kubernetes version 'v1.19.3+vmware.1'

Now we can see that the workload cluster is also upgraded to TKG 1.2.1 version.

ubuntu@cli-vm:~$  tkg get cluster --include-management-cluster
 NAME                             NAMESPACE   STATUS   CONTROLPLANE  WORKERS  KUBERNETES        ROLES
 vsphere-workload-1               default     running  1/1           1/1      v1.19.3+vmware.1  <none>
 tkg-mgmt-vsphere-20210129224846  tkg-system  running  1/1           1/1      v1.19.3+vmware.1  management

This completes the TKG upgrade process. Thank you for reading this post.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: