Tanzu cluster is not visible after deployment? Tanzu CLI installation and accessing clusters in vSphere 8

Last time, I deployed a new cluster. For this task, I used Tanzu Mission Control. Everything went well, the machines were created. Than, I connect to dedicated vSphere namespace and I’m trying to list TKC clusters. And a new cluster was not visible…Why? The reason was very clear: upgraded vSphere form v7 to v8 and changed API from v1alpha3 API to Cluster v1beta1 API for clusters. And at the same time, kind TKC was changed to kind Cluster.

In this article, I want to show you how to easily manage a new type of clusters in vSphere (8) with Tanzu environment using Tanzu CLI.

1. Cluster deployment and overview

We can deploy Workload clusters in a few ways. One of them is deployment using TMC – Tanzu Mission Control. If you had a vSphere 7, than vSphere 8 and upgraded Supervisor to version minimum 1.24.x, a new cluster settings will appear. In my case it’s a vSphere 8.0 U1c with Supervisor in version 1.25.6.

In the TMC cluster creation wizard in 2nd step, “Cluster class” option appears. That means, new clusters, by default, will be created with Cluster v1beta1 API. There are more options to set in the next steps, but I don’t cover it in this article.

Between Cluster v1beta1 API and earlier APIs are lot of configuration changes. One of them, is introduced in TKG 2.0 a new resource pool called ClusterClass (default one is a tanzukubernetescluster).
ClusterClass is a collection of templates that define cluster topologies and configurations. It has functions like provisioning of Kubernetes clusters across different cloud platforms using a simple YAML cluster configuration that references the ClusterClass CRD or allows for the use of variables to customize clusters.

Here is a created cluster. From this perspective looks similar like in vSphere 7, right? Maybe one change is visible – there is no word “control” in the control plane node name. Word “worker” is set by me.

If you log in to the user vSphere namspace and try to list TKC cluster, there is a information “No resources found in ns01 namespace” Why? Because, mat-cl01 cluster, created from TMC is running Cluster v1beta1 API and the Kind of cluster object is not TanzuKubernetesCluster (like with v1alpha3 API), it’s just a Cluster.
If you have a running clusters created before upgrade to vSphere 8, kubectl get tkc should list this objects. It was created with a different API.

If you type a command kubectl get clusters, a new cluster will be visible and you can change context to access them.
Moreover, if you want to make some changes on this cluster, for example add new worker or change VM Class, just type kubectl edit cluster [name of the cluster]. Similar like with TKC cluster (command).

Yes, this is some workaround to simple mange of the cluster. But, there is a different, more perspective, efficient and with more capabilities way – Tanzu CLI.

2. Tanzu CLI installation

Tanzu CLI is command line tool, that connects you to VMware Tanzu. With Tanzu CLI you can perform many different tasks like: create and manage workload clusters, install Tanzu Packages or configure the Tanzu CLI itself.
More information and compatibility matrix you can find here:
https://docs.vmware.com/en/VMware-Tanzu-CLI/index.html

In my lab, I have installed vSphere 8 U1c with running TKG v2.2. That means, the target version for this congratulation is Tanzu CLI v0.29.x
https://docs.vmware.com/en/VMware-Tanzu-CLI/0.29.0/vmware-tanzu-cli-ref/tanzu-cli.html

1. Go to this page: https://customerconnect.vmware.com/en/downloads/details?downloadGroup=TKG-220&productId=1400&rPId=110858
and download VMware Taznu CLI for [your system] tar.gz package.

2. Unpack package.
tar -xvf tanzu-cli-bundle-darwin-amd64.tar.gz

3. Navigate to the cli folder and than, make the CLI available in the system. Next, initialize Tanzu CLI and check installed version.
cd cli
sudo install core/v0.29.0/tanzu-core-darwin_amd64 /usr/local/bin/tanzu
tanzu init
tanzu version

Installation successful!

3. Access to the Cluster using Tanzu CLI

1. The first step is to connect to the Supervisor as a vCenter SSO user.
kubectl vsphere login --server=10.0.42.13 --vsphere-username mateusz@vsphere.local --insecure-skip-tls-verify

2. Get available contexts and switch to Supervisor context.
kubectl config get-contexts
kubectl config use-context 10.0.42.13

3. Now, log in to the Supervisor using the Tanzu CLI. I’ve here some errors and I don’t be sure why is that. Anyways, instillation was successful without any problems 😉
tanzu login --kubeconfig ~/.kube/config --context 10.0.42.13 --name supervisor01

4. List available Tanzu CLI plugin list.

5. List available cluster in vSphere namespace ns01.
And here it’s our cluster! As you can see, there are more details and information instead of using command kubectl get clusters.

6. Now, it’s time to connect to the existing cluster using Tanzu CLI. Change context to the desired vSphere namespace.
kubectl config use-context ns01

7. Get kubeconfig file for the desired cluster.
tanzu cluster kubeconfig get -n ns01 mat-cl01 --admin

8. Switch context for the desired cluster using user from the last step. And for example, list cluster nodes.
kubectl config use-context mat-cl01-admin@mat-cl01
(optional) kubectl get nodes

Leave a Reply

Your email address will not be published. Required fields are marked *