TKC Cluster creation fails with an “no kind “TanzuKubernetesCluster” is registered” error

I tried provisioning a Tanzu Kubernetes Cluster (TKC) on vSphere with Tanzu Supervisor Cluster after few months and really spend few hours to troubleshoot the following error. So, I thought to write a small blog about this weird error message and what resolution steps worked for me.

Error

Here is the error message I saw after triggering the TKC creation.

root@dinesh:~# k get tkc -A
NAMESPACE     NAME              CONTROL PLANE   WORKER   DISTRIBUTION                     AGE     PHASE     TKR COMPATIBLE   UPDATES AVAILABLE
tanzutest01   tkgs-cluster-2    1               1        v1.20.2+vmware.1-tkg.1.1d4f79a   2m41s   failed    True

root@dinesh:~# k logs tkc/tkgs-cluster-2 -n tanzutest01
error: no kind "TanzuKubernetesCluster" is registered for version "run.tanzu.vmware.com/v1alpha1" in scheme "k8s.io/kubectl/pkg/scheme/scheme.go:28"

I am not really sure if the above error message is very generic, but I was really unable to decide anything after reading it.

Couple of checks I did on the vCenter UI. I checked the compute tab on vSphere namespace and it was showing failed status without any error message.

I was really unable to find anything on the internet too about this. Let’s understand the reason of an error now.

Reason

After hours of investigation, I just noticed that there was no VM Class associated with the namespace. See the below screenshot for reference.

Resolution

In order to resolve the error message, we can simply add the VM Class on supervisor namespace. There are two options:

  • Add all available VM Classes
  • Select an appropriate one (basically the one you are referring in your TKC cluster definition yaml file)

Let’s add the VM Class to supervisor namespace now.

– Login to vCenter and select the supervisor namespace that you are using to create a TKC

– Select the Summary tab

– Click on ADD VM CLASS option

– Select an appropriate VM Classes and Click on OK

– Now you can see the count of added VM Classes on a supervisor namespace.

– Also, validate the virtualmachineclassbinding by running the following command

root@dinesh:~# k get virtualmachineclassbinding -n tanzutest01
NAME                 VIRTUALMACHINECLASS   AGE
best-effort-large    best-effort-large     90s
best-effort-medium   best-effort-medium    90s

– Now, you should be able to create the TKC. Try creating a cluster.

I think it would be really nice if a cluster creation command checks the VM classes are associated with the supervisor namespace or not and display a meaningful message to the end user.

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s