If you are deploying multiple management clusters using same bootstrap node, you might see only current management cluster and its respective workload clusters. But, how to see other management clusters and their workload clusters? I will explain step by step process to do the same.
Steps to change TKG management cluster context
- Login to bootstrap node or other node from where you are accessing the tanzu cli. You can use ssh or RDP based on the OS of node.
2. Run the following command to see the current management cluster
$ tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
demo-cluster-mgmt tkg-system running 1/1 1/1 v1.20.5+vmware.1 management
Details:
NAME READY SEVERITY REASON SINCE MESSAGE
/demo-cluster-mgmt True 97m
├─ClusterInfrastructure - VSphereCluster/demo-cluster-mgmt True 97m
├─ControlPlane - KubeadmControlPlane/demo-cluster-mgmt-control-plane True 97m
│ └─Machine/demo-cluster-mgmt-control-plane-xljxx True 97m
└─Workers
└─MachineDeployment/demo-cluster-mgmt-md-0
└─Machine/demo-cluster-mgmt-md-0-5589d8b666-sz2t9 True 97m
Providers:
NAMESPACE NAME TYPE PROVIDERNAME VERSION WATCHNAMESPACE
capi-kubeadm-bootstrap-system bootstrap-kubeadm BootstrapProvider kubeadm v0.3.14
capi-kubeadm-control-plane-system control-plane-kubeadm ControlPlaneProvider kubeadm v0.3.14
capi-system cluster-api CoreProvider cluster-api v0.3.14
capv-system
3. Above output is just showing one management cluster which is set currently. Now, lets look at other management cluster.
View the content of “~/.tanzu/config.yaml” file
$ cat ~/.tanzu/config.yaml
clientOptions:
cli:
repositories:
- gcpPluginRepository:
bucketName: tanzu-cli
name: core
- gcpPluginRepository:
bucketName: tanzu-cli-tkg-plugins
name: tkg
current: demo-cluster-mgmt
metadata:
creationTimestamp: null
servers:
- managementClusterOpts:
context: demo3-cluster-mgmt-admin@demo3-cluster-mgmt
path: /root/.kube-tkg/config
name: demo3-cluster-mgmt
type: managementcluster
- managementClusterOpts:
context: demo2-management-admin@demo2-management
path: /root/.kube-tkg/config
name: demo2-management
type: managementcluster
- managementClusterOpts:
context: demo-cluster-mgmt-admin@demo-cluster-mgmt
path: /root/.kube-tkg/config
name: demo-cluster-mgmt
type: managementcluster
Here you can see that there are 3 management cluster. You can see the current context set above.
4. To update the management cluster, edit the above config.yaml file with the management cluster name.
5. Now, Run the below command
$ tanzu management-cluster get
You will see the management cluster that you updated in config.yaml file above.