While I was playing around with TKG MultiCloud (aka “TKGm”) on vSphere I ran into the error “Failed to initiate cluster deployment cluster name vktrsmgmt matches another management cluster”.
Although I’ve used the vktrsmgmt during a previous deployment, currently the vktrsmgmt cluster is not available anymore:
$ tanzu cluster list --include-management-cluster NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES PLAN
However the tanzu login command still showed the vktrsmgmt cluster:
$ tanzu login ? Select a server [Use arrows to move, type to filter] > vktrsmgmt () + new server
Apparently this had to do with not deleting this management cluster in a proper way, leaving behind the context of a previous Tanzu management cluster. The .tanzu directory on your bootstrap machine containers information about deployed TKG clusters, however there’s also a kube-tkg directory that holds a config file that contains all the contexts of available TKG clusters. Although it should be possible to edit this file manually, there’s also a command edit the configuration and remove superfluous contexts.
First get an overview of available contexts:
$ tanzu config server list NAME TYPE ENDPOINT PATH CONTEXT vktrsmgmt managementcluster /Users/vvandenberg/.kube-tkg/config vktrsmgmt-admin@vktrsmgmt
And then delete the context:
$ tanzu config server delete vktrsmgmt Deleting the sever entry from the config will remove it from the list of tracked servers. You will need to use tanzu login to track this server again. Are you sure you want to continue? [y/N]: y Deleting entry for cluster vktrsmgmt
The context is now removed and can be reused. Good luck!