kubectl login fetching multiples clusters.
search cancel

kubectl login fetching multiples clusters.

book

Article ID: 431646

calendar_today

Updated On:

Products

Tanzu Kubernetes Runtime

Issue/Introduction

Attempting to login into a guest cluster and get response from other clusters. 

$ kubectl vsphere login \
   --server=<SUPERVISOR_CONTROL_PLANE_IP> \
   --vsphere-namespace=<VSPHERE_NAMESPACE> \
   --tanzu-kubernetes-cluster-name=<TKG_CLUSTER_NAME> \
   --insecure-skip-tls-verify \
   -v=10

[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:32:54.478" level=debug msg="Logging in to Tanzu Kubernetes cluster (###-##-####-######) (####-######)" --> This is (The target)
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:32:55.048" level=info msg="Successfully logged in to Tanzu Kubernetes cluster ##.##.##.##"  --> Success logged in the target
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:32:55.062" level=debug msg="Trying to login to ######.###" --> Continue trying to login on the other clusters
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:32:55.062" level=debug msg="Creating wcp.Client for ######.###."   
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:33:25.063" level=warning msg="Error occurred during HTTP request: Post \"https://######.###/wcp/login\": dial tcp ##.###.##.##:443: i/o timeout" 
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:33:25.063" level=error msg="Login failed: Post \"https://######.###/wcp/login\": dial tcp ##.###.##.##:443: i/o timeout"  
[YYYY-MM-DDTHH:MM:SS] time="####-##-## 15:33:25.063" level=debug msg="Failed to connect to ######.###, err: Post \"https://######.###/wcp/login\": dial tcp ##.###.##.##:443: i/o timeout"
[YYYY-MM-DDTHH:MM:SS] Failed to login to supervisor cluster using ######.###. Please check network connectivity.Not all cluster/workload sessions were established. Login failed for the following clusters/workloads: --> Failed connection the other clusters/supervisor under same domain. 

Environment

VMware Kubernetes Supervisor (VKS) 

Cause

kubectl-vsphere login validates and merges contexts rather than operating only on the explicitly provided target. If the existing kubeconfig already contains contexts for other Supervisors, kubectl-vsphere login will attempt to validate those contexts and then generates/updates a merged kubeconfig containing all valid existing and newly added contexts.

Resolution

Rename (or move) the existing kubeconfig so kubectl-vsphere login starts with a clean config and generates a new file containing only the target connection you specify. 

This command is applicable to Linux or Mac.

mv ~/.kube/config ./kubeconfig-backup