Tanzu KubernetestaTanzu Kubernetes Grid 1.4 is all set to be released today. A lot of new features are coming up with this release including (not limited to):
- K8’s versions including 1.21.2, 1.20.8, and 1.19.12 are supported with the 1.4 release.
- Support for NSX Advanced Load Balancer versions 20.1.3 & 20.1.6.
- New vSphere configuration variables “VSPHERE_REGION” and “VSPHERE_ZONE” are added to enable CSI storage for workload clusters in vSphere environments with multiple data centers or clusters.
- Supports L7 ingress (using NSX ALB) for workload clusters.
- AKO deployment is fully automated. No need to install it via helm or using custom yaml for deployment as both AKO and AKO Operator are provided as core packages.
It’s a good time to upgrade TKG in the lab and through this blog post, I will walk through the steps of upgrading TKGm from v1.3 to v1.4.
Upgrade Procedure
Step 1: Download and install the new version of the Tanzu CLI and Kubectl on the bootstrapper machine.
1.1: Upgrade kubectl
The below steps assumes that you have already downloaded the necessary TKG binaries and uploaded them to the bootstrapper machine and extracted the installer.
[root@tkg-bootstrapper ~]# mv /usr/local/bin/kubectl /usr/local/bin/kubectl-old
[root@tkg-bootstrapper ~]# cd kubectl-linux-v1.21.2+vmware.1/
[root@tkg-bootstrapper ~]# chmod +x kubectl
[root@tkg-bootstrapper ~]# mv kubectl /usr/local/bin/
Verify the Kubectl version
1 2 3 4 5 |
[root@tkg-bootstrapper ~]# kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2+vmware.1", GitCommit:"54e7e68e30dd3f9f7bb4f814c9d112f54f0fb273", GitTreeState:"clean", BuildDate:"2021-06-28T22:17:36Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5+vmware.2", GitCommit:"13a5d1c1f3860de79bb2aa1448af2025c974d111", GitTreeState:"clean", BuildDate:"2021-05-16T00:39:21Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"} |
1.2: Upgrade Tanzu CLI
[root@tkg-bootstrapper ~]# mv /usr/local/bin/tanzu /usr/local/bin/tanzu-old
[root@tkg-bootstrapper ~]# cd ~/tanzu-cli-bundle-linux-amd64/cli
[root@tkg-bootstrapper ~]# install core/v1.4.0/tanzu-core-linux_amd64 /usr/local/bin/tanzu
Verify Tanzu CLI version
1 2 3 4 5 6 7 8 9 |
[root@tkg-bootstrapper ~]# tanzu version ! Configuration is now stored in /root/.config/tanzu. Legacy configuration directory /root/.tanzu is deprecated and will be removed in a future release. ! To complete migration, please remove legacy configuration directory /root/.tanzu and adjust your script(s), if any, to point to the new location. version: v1.4.0 buildDate: 2021-08-30 sha: c9929b8f |
1.3: Upgrade Tanzu Plugins
[root@tkg-bootstrapper ~]# tanzu plugin clean
[root@tkg-bootstrapper ~]# cd ~/tanzu-cli-bundle-linux-amd64
[root@tkg-bootstrapper ~]# tanzu plugin install –local cli all
Verify Tanzu Plugins version
1 2 3 4 5 6 7 8 9 10 |
[root@tkg-bootstrapper ~]# tanzu plugin list NAME DESCRIPTION REPOSITORY VERSION STATUS alpha Alpha CLI commands core not installed cluster Kubernetes cluster operations core v1.4.0 installed kubernetes-release Kubernetes release operations core v1.4.0 installed login Login to the platform core v1.4.0 installed management-cluster Kubernetes management cluster operations core v1.4.0 installed package Tanzu package management v1.4.0 installed pinniped-auth Pinniped authentication operations (usually not directly invoked) core v1.4.0 installed |
Step 2: Import new versions of the Kubernetes template images that the upgraded management and Tanzu Kubernetes clusters will run.
The following K8 templates are available in TKG 1.4:
- photon-3-kube-v1.19.12+vmware.1-tkg.2-2347849454212388110.ova
- photon-3-kube-v1.20.8+vmware.1-tkg.2-9893064678268559535.ova
- photon-3-kube-v1.21.2+vmware.1-tkg.2-12816990095845873721.ova
- ubuntu-2004-kube-v1.19.12+vmware.1-tkg.1-15841320193950299489.ova
- ubuntu-2004-kube-v1.20.8+vmware.1-tkg.1-17589475007677388652.ova
- ubuntu-2004-kube-v1.21.2+vmware.1-tkg.1-7832907791984498322.ova
Depending on the K8 version to which you want to upgrade, import the corresponding template into vSphere.
In my lab, I am going to bump my setup to the latest K8 version, hence I have uploaded the photon-3-kube-v1.21.2+vmware.1 ova image and converted it into a template.
Step 3: Upgrade Management Clusters
To upgrade the Tanzu Kubernetes Grid instance, you must upgrade all management clusters in your deployment. You cannot upgrade Tanzu Kubernetes clusters until you have upgraded the management clusters that manage them.
3.1: List the management clusters available for upgrade.
1 2 3 4 5 6 7 |
[root@tkg-bootstrapper ~]# tanzu cluster list --include-management-cluster NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN tkg13-wld01 onprem-wld running 3/3 3/3 v1.20.5+vmware.2 <none> prod tkg13-mgmt tkg-system running 3/3 1/1 v1.20.5+vmware.2 management prod |
I only have one management cluster running at Kubernetes version v1.20.5 in my environment.
3.2: To upgrade the management cluster, run the tanzu management-cluster upgrade command and enter y
to confirm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
[root@tkg-bootstrapper ~]# tanzu management-cluster upgrade --timeout 45m0s Upgrading management cluster 'tkg13-mgmt' to TKG version 'v1.4.0' with Kubernetes version 'v1.21.2+vmware.1'. Are you sure? [y/N]: y cluster specific secret is not present, fallback on bootstrap credential secret Upgrading management cluster providers... Checking cert-manager version... Deleting cert-manager Version="v0.16.1" Installing cert-manager Version="v1.1.0" Waiting for cert-manager to be available... Performing upgrade... Deleting Provider="cluster-api" Version="" TargetNamespace="capi-system" Installing Provider="cluster-api" Version="v0.3.23" TargetNamespace="capi-system" Deleting Provider="bootstrap-kubeadm" Version="" TargetNamespace="capi-kubeadm-bootstrap-system" Installing Provider="bootstrap-kubeadm" Version="v0.3.23" 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.23" TargetNamespace="capi-kubeadm-control-plane-system" Deleting Provider="infrastructure-vsphere" Version="" TargetNamespace="capv-system" Installing Provider="infrastructure-vsphere" Version="v0.7.10" TargetNamespace="capv-system" Management cluster providers upgraded successfully... Upgrading management cluster kubernetes version... Verifying kubernetes version... Retrieving configuration for upgrade cluster... Create InfrastructureTemplate for upgrade... cluster specific secret is not present, fallback on bootstrap credential secret Upgrading control plane nodes... Patching KubeadmControlPlane with the kubernetes version v1.21.2+vmware.1... Waiting for kubernetes version to be updated for control plane nodes Upgrading worker nodes... Patching MachineDeployment with the kubernetes version v1.21.2+vmware.1... Waiting for kubernetes version to be updated for worker nodes... updating additional components: 'metadata/tkg' ... updating additional components: 'addons-management/kapp-controller' ... updating additional components: 'addons-management/standard-package-repo' ... updating additional components: 'addons-management/tanzu-addons-manager' ... updating additional components: 'tkr/tkr-controller' ... updating additional components: 'addons-management/core-package-repo' ... Waiting for additional components to be up and running... Waiting for packages to be up and running... Management cluster 'tkg13-mgmt' successfully upgraded to TKG version 'v1.4.0' with kubernetes version 'v1.21.2+vmware.1' |
Note: If you have imported the same version of Kubernetes templates, for e.g Photon and Ubuntu templates with Kubernetes v1.21.2, specify –os-name in the upgrade command to upgrade your management cluster to run a specific os version.
Note: If for some reason the upgrade times out before it completes, run the upgrade command with the –timeout option with a value greater than the default of 30 minutes.
The upgrade process first upgrades the Cluster API providers followed by upgrading the Kubernetes version on all the control plane and worker nodes of the management cluster.
3.3: Verify that the management cluster has been upgraded.
1 2 3 4 5 |
[root@tkg-bootstrapper ~]# tanzu cluster list --include-management-cluster NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN tkg13-wld01 onprem-wld running 3/3 3/3 v1.20.5+vmware.2 <none> prod tkg13-mgmt tkg-system running 3/3 1/1 v1.21.2+vmware.1 management prod |
The above output shows that the management cluster is now running the new version (v1.21.2) of Kubernetes, but the workload cluster is still running previous versions of Kubernetes.
Step 4: Upgrade Tanzu Kubernetes Clusters
If you have more than one management cluster, switch to the management cluster context which is managing the Tanzu Kubernetes cluster that you want to upgrade.
3.1: List Tanzu Kubernetes Clusters available for upgrade
Run the tanzu cluster list command to verify the version of Kubernetes that is running in the Tanzu Kubernetes cluster.
1 2 3 4 5 |
[root@tkg-bootstrapper ~]# tanzu cluster list NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN tkg13-wld01 onprem-wld running 3/3 3/3 v1.20.5+vmware.2 <none> prod |
3.2: To discover which versions of Kubernetes are available for upgrade, run the below command against your Tanzu Kubernetes Cluster
1 2 3 4 5 6 |
[root@tkg-bootstrapper ~]# tanzu cluster available-upgrades get tkg13-wld01 -n onprem-wld NAME VERSION COMPATIBLE v1.20.8---vmware.1-tkg.2 v1.20.8+vmware.1-tkg.2 True v1.21.2---vmware.1-tkg.1 v1.21.2+vmware.1-tkg.1 True |
3.3: To upgrade Tanzu Kubernetes clusters, run the tanzu cluster upgrade <CLUSTER-NAME> command and enter y to confirm.
Note: If the Tanzu Kubernetes cluster is not running in the default namespace, specify the –namespace option with the upgrade command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@tkg-bootstrapper ~]# tanzu cluster upgrade tkg13-wld01 -n onprem-wld --os-name photon Upgrading workload cluster 'tkg13-wld01' to kubernetes version 'v1.21.2+vmware.1'. Are you sure? [y/N]: y Validating configuration... Verifying kubernetes version... Retrieving configuration for upgrade cluster... Create InfrastructureTemplate for upgrade... cluster specific secret is not present, fallback on bootstrap credential secret Upgrading control plane nodes... Patching KubeadmControlPlane with the kubernetes version v1.21.2+vmware.1... Waiting for kubernetes version to be updated for control plane nodes Upgrading worker nodes... Patching MachineDeployment with the kubernetes version v1.21.2+vmware.1... Waiting for kubernetes version to be updated for worker nodes... updating additional components: 'metadata/tkg' ... updating additional components: 'addons-management/kapp-controller' ... updating additional components: 'addons-management/standard-package-repo' ... Waiting for packages to be up and running... Warning: Cluster is upgraded successfully, but some packages are failing. Failure while waiting for packages to be installed: waiting for 'vsphere-csi' Package to be installed Cluster 'tkg13-wld01' successfully upgraded to kubernetes version 'v1.21.2+vmware.1' |
3.4: Verify that Tanzu Kubernetes cluster has been upgraded to newer Kubernetes version
1 2 3 4 |
[root@tkg-bootstrapper ~]# tanzu cluster list NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN tkg13-wld01 onprem-wld running 3/3 3/3 v1.21.2+vmware.1 <none> prod |
The above output confirms that the cluster is now upgraded to v1.21.2.
And that’s it for this post. In the next post, I will cover the steps of upgrading TKG Extensions. Stay tuned!!!
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing.