set context to a worker cluster
tanzu init
tanzu login
tanzu mangement-cluster create {name} --ui
tanzu mc create {name} --file {file}
seems that if not work first need to delete from config file.
tanzu mc delete {mc name}
tanzu config server list
tanzu config server delete {mc name}
location of config gile(kubeconfig)
.kube/config << for worker clusters
.kube-tkg/config << for mgmt clusters
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config current-context
tce-management-cluster-admin@tce-management-cluster
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* tce-management-cluster-admin@tce-management-cluster tce-management-cluster tce-management-cluster-admin
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-clusters
NAME
tce-management-cluster
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config get-users
NAME
tce-management-cluster-admin
how to delete clusters, contexts, users using kubectl
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-context tce-mgmt-cluster-admin@tce-mgmt-cluster
deleted context tce-mgmt-cluster-admin@tce-mgmt-cluster from /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-cluster tce-mgmt-cluster-admin@tce-mgmt-cluster
error: cannot delete cluster tce-mgmt-cluster-admin@tce-mgmt-cluster, not in /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-cluster tce-mgmt-cluster
deleted cluster tce-mgmt-cluster from /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ vi /home/brewinstall/.kube/config
[brewinstall@tanzu-bootstrap-cluster ~]$ kubectl config delete-user tce-mgmt-cluster-admin
deleted user tce-mgmt-cluster-admin from /home/brewinstall/.kube/config
kubectl config use-context my-cluster-admin@my-cluster
kubectl cluster-info
[ec2-user@ip-10-0-31-78 ~]$ kubectl get po
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[ec2-user@ip-10-0-31-78 ~]$ kubectl api-versions
error: couldn't get available api versions from server: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config