Table of Contents
This blog series will cover how to deploy Tanzu Kubernetes Grid on vSphere and get your management and workload clusters provisioned. In part 1 of this series, I will cover the prerequisites that need to be met before attempting to install & configure TKG on vSphere.
Before you start with TKG deployment, make yourself familiar with the components that make up the TKG cluster.
Hardware & Software Requirements
- A vSphere environment with vSphere 6.7 U3 or 7.0 installed.
- A dedicated resource pool to accommodate TKG Management & Workload cluster components.
- A VM folder where TKG VM’s will be provisioned.
- One DHCP enabled network segment. TKG VM’s get IP from dhcp pool.
- TKG Ova’s & TKG CLI downloaded from here
- A linux vm (ubuntu preferred) created in vSphere with docker & kubectl installed. This vm act as bootstrap vm on which we will install TKG CLI and other dependencies.
My Lab Walkthrough
- I have a 4 node vSphere cluster with vSphere 6.7 U3 installed and licensed with Enterprise plus license
- Build numbers used for ESXi & vCenter are 16316930 & 16616668 respectively.
- I created a dedicated resource pool named TKG-RP for TKG VM’s.
- A dedicated folder named TKG-Infra to collect the Tanzu Kubernetes Grid VM’s.
For networking I am using vyos, which is acting as ToR switch for my ESXi hosts, so I have leveraged DHCP functionality of vyos for one of the vSphere network. My TKG vm’s will be connecting to this portgroup.
For bootstrap environment, I have a vm with Ubuntu desktop v20 installed. This VM has 2 vCPU and 8 GB memory and 40 GB disk space allocated.
TKG Setup Steps
Preparing Bootstrap Environment
Connect to the linux vm used for bootstrapping and install Kubectl & Docker there.
1a: Install kubectl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt-get update sudo apt-get install kubectl -y # kubectl version --client Client Version: version.Info { "Major":"1", "Minor":"18", "GitVersion":"v1.18.8", "Platform":"linux/amd64" } |
1b: Install & Setup Docker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
sudo apt-get install ca-certificates curl gnupg-agent software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io # systemctl enable docker && systemctl start docker Verify Docker Version # docker version Client: Docker Engine - Community Version: 19.03.12 |
1c: Install TKG CLI
Download the TKG CLI binary from here and upload it on the bootstrap vm and run below commands to install it.
1 2 3 4 5 6 7 8 9 10 11 12 |
# gunzip tkg-linux-amd64-v1.1.2-vmware.1.gz # mv tkg-linux-amd64-v1.1.2-vmware.1 /usr/local/bin/tkg # chmod +x /usr/local/bin/tkg Verify that TKG cli is installed # tkg version Client: Version: v1.1.2 Git commit: c1db5bed7bc95e2ba32cf683c50525cdff0f2396 |
Note: Running above command automatically creates /root/.tkg folder and tkg config file is placed in this folder.
1d: Create SSH Key Pair
In order for TKG VM’s to run tasks in vSphere, you need to provide the public key part of SSH key pair to TKG when deploying management cluster. Use below commands to create SSH key pair.
1 2 3 4 |
# ssh-keygen -t rsa -b 4096 -C tanzu@vstellar.com # ssh-add /root/.ssh/id_rsa Identity added: /root/.ssh/id_rsa (tanzu@vstellar.com) |
Note: Note down the contents of /root/.ssh/id_rsa.pub as we need this while creating config.yaml file for TKG mgmt cluster deployment.
Deploy TKG OVA’s & Create Templates in vSphere
Before we can deploy a TKG management cluster or Tanzu compute/workload clusters, we need to provide a base OS image template to vSphere. TKG uses these templates to creates management/compute cluster.
The base os images are available in myvmware portal. Basically you need below images:
- Photon v3 Kubernetes v1.17.6 OVA or Photon v3 Kubernetes v1.18.3 OVA
- Photon v3 capv haproxy v1.2.4 OVA
Once the ova’s are downloaded, deploy both of them in vSphere and convert the deployed appliance into template.
And that completes the infra setup part. We are now ready to deploy TKG management cluster followed by compute/workload cluster. Stay tuned for part 2 of this series !!!
I hope you enjoyed reading the post. Feel free to share this on social media if it is worth sharing 🙂