kubernetes kubectl stalls for 2 Minutes

6/10/2017

I am running kubectl on: Microsoft Windows [Version 10.0.14393]

Pointing to Kubernetes cluster deployed in Azure.

A kubectl version command with verbose logging and preceded with time echo shows a delay of ~ 2 Min before showing any activity on the API calls.

Note the first log line that show 2 Min after invoking the command.

C:\tmp>echo **19:12:50**.23
19:12:50.23

C:\tmp>kubectl version --kubeconfig=C:/Users/jbafd/.kube/config-hgfds-acs-containerservice-1 -v=20
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2
017-05-19T18:44:27Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"windows/amd64"}
I0610 **19:14:58.311364    9488 loader.go:354]** Config loaded from file C:/Users/jbafd/.kube/config-hgfds-acs-containerservice-1
I0610 19:14:58.313864    9488 round_trippers.go:398] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl.exe/v1.6.4 (windows/amd64) kub
ernetes/d6f4332" https://xxjjmaster.australiasoutheast.cloudapp.azure.com/version
I0610 19:14:58.519869    9488 round_trippers.go:417] GET https://xxjjmaster.australiasoutheast.cloudapp.azure.com/version  in 206 milliseconds

Other kubectl commands (get nodes etc.) exhibit the same delay. Flushing dns cache didn't resolve the issue but it looks like the API requests are responsive. Also running the command as admin didn't help. What other operation kubectl is attempting before loading the config?

-- S. Avi
kubectl
kubernetes

1 Answer

8/20/2019

there could be two reasons for latency

  1. kubectl is on network drive(mostly H: drive) so kubectl is first copied to your. system and the run
  2. .kube/config file is on network drive

So to summarise either of the thing is on network drive you will face.

You can try one more thing if this doesn't work out, you can run kubectl command -v=20 this will give all the time duration taken by it.

reference

-- prashant
Source: StackOverflow