Setup Tanzu Community Edition on vSphere

Geoffrey Rekier
3 min readOct 11, 2021

This article will show what needs to be done to have a Kubernetes cluster running with Tanzu on vSphere 7.
An important note is that we do not have NSX setup in our environment so we need an extra step to get IP addresses for our LoadBalancer services.

Assumptions

  1. We will assume that we have a vSphere setup version 7 with a DRS enabled cluster.
  2. You have docker and kubectl CLI installed.
  3. You already have an SSH key generated.

Pre-requisites

Tanzu CLI
For Windows, you can download a zip from https://github.com/vmware-tanzu/community-edition/releases unpack and run install.bat
For Linux/Mac, the easiest way is to use Homebrew.

brew tap vmware-tanzu/tanzu 
brew install tanzu-community-edition
{HOMEBREW-INSTALL-LOCATION}/configure-tce.sh

Template VM
Download the OVA from https://customerconnect.vmware.com/downloads/get-download?downloadGroup=TCE-090
For vSphere, you should get a photon OS with the correct version of Kubernetes you wish to install.

After deployment, you need to convert the VM to template.

Deployment — Management Cluster

There are a couple of options for deployment. Managed or standalone. Standalone is nice if you want to try it out locally with Docker however, there are issues with this setup after restart. In any case, we are looking at vSphere so we will deploy a managed cluster.

First, we will need the management cluster. To bootstrap it, run:

tanzu management-cluster create --ui -v 9

the “v” flag is to get more verbose logging. Default is 6.

This will start your browser and will guide you through the setup. Most steps are quite obvious like the IP/FQDN for vCenter, username, password, etc… Following, we will mentioned the steps and configuration points that are not 100% straight forward.

First, we need to choose the type of deployment (AWS, Azure, vSphere or Docker). We will choose vSphere.

Wizard steps:

  1. vCenter info: Fill them in then click “Connect” to be able to choose the Datacenter. The SSH key is up to you. You can get it from
    cat ~/.ssh/id_rsa.pub
    and paste the result here.
  2. Cluster settings: Choose development. We can change the number of nodes after and, in my experience, there is always a timeout ruining the installation when choosing the production deployment.
    I usually set the Instances types to “large” but this is up to you. As mentioned, you can scale the number of nodes after.
    Also assign the management IP for this cluster.
  3. NSX: We don’t have this so we just skip this.
  4. Metadata: Really up to you. These are just used as tags in the cluster.
  5. Resources: Choose your folder, datastore and cluster according to where you want to deploy your clusters.
  6. Network: It should be a network that has access to the web. The default CIDR are fine and proxy setting will depend on your vSphere installation
  7. Identity management: You can disable this without any issues. It is to authenticate users and certificates will be used if this is turned off.
  8. OS image is a drop down that will show the template created above (under Template VM)
  9. You can skip registration
  10. Review and deploy

This will take some time so you can grab a cup of coffee. It needs to create VMs and install management software. It might look like it hangs some time but be patient. 15–20 minutes would be normal.

Deployment — Workload Cluster

From the previous deployment, a file will be created under ${HOME}/.config/tanzu/tkg/clusterconfigs

This YAML file is the configuration file used for the deployment. We will use it as a startup point for our workload cluster.

Make a copy of the YAML file. i.e. workload1.yaml and open it in your favorite editor.

cp  ~/.config/tanzu/tkg/clusterconfigs/<MGMT-CONFIG-FILE> ~/.config/tanzu/tkg/clusterconfigs/workload1.yaml
vim ~/.config/tanzu/tkg/clusterconfigs/workload1.yaml

We need to change the CLUSTER_NAME and VSPHERE_CONTROL_PLANE_ENDPOINT (IP). Then we can run the new file to create a workload cluster with:

tanzu cluster create --file workload1.yaml -v 9 
tanzu cluster kubeconfig get <CLUSTER_NAME> --admin
kubectl config use-context <CLUSTER_NAME>-admin@<CLUSTER_NAME>

Again, the first line will create the cluster and thus will take some time. Second and third line is to fetch the credential information and use them for kubectl.

That’s it

You now have a fully functional Kubernetes cluster on your own vSphere environment.

In my next article, I will go into the concept of “Packages” from Tanzu Community Edition and describe which packages and how to install them to get a better cluster ready for development.

Thanks for reading.

--

--

Geoffrey Rekier

Senior developer and team lead for over 15 years. Most of them within consulting.