After a management cluster context name change using below command:
kubectl config rename-context <old-context-name> <new-context-name>
and then running either of below commands:
tanzu mc get
tanzu management-cluster get
The following error is displayed:
Error: clusters.cluster.x-k8s.io "<management_cluster_context name>" not foundTKGm 2.5.3
Changing the management cluster context name with the 'kubectl config rename-context' command will only update the below directory/file:
.kube/config
The management cluster context name will also exist in and need to be correct in the below yamls:
.config/tanzu/config.yaml
.config/tanzu/config-ng.yamlBoth the ".kube/config" and the ".config/tanzu/config-ng.yaml" files must be updated with the correct management cluster context name.
Run below command to get the management cluster context name:
kubectl config get-contexts
In the ".kube/config" the context must have the correct management cluster context name similar to below:
...
name: <management-cluster-context-name>
- cluster:
certificate-authority-data: LS0t.......
server: https://##.##.##.##:6443
...
...
- context:
cluster: <management-cluster-name>
user: kubernetes-admin
name: kubernetes-admin@<management-cluster-name>
and in the ".config/tanzu/config-ng.yaml" the context must also have the correct management cluster context name
...
contexts:
- name: <management-cluster-context-name>
target: kubernetes
contextType: kubernetes
clusterOpts:
endpoint: https://##.##.##.##:6443
path: /home/xxxx/.kube/config
context: <management-cluster-context-name> #---- Change this to the correct management cluster context name
isManagementCluster: true
additionalMetadata:
isPinnipedEndpoint: true
...