'Suddenly getting "Unable to connect to the server: net/http: TLS handshake timeout" from kubectl

My vanilla kubernetes cluster running on 'Docker for Mac' was running fine without any real load. Now, I deployed a few services and istio. Now, I am getting this error:

$ kubectl get pods --all-namespaces
Unable to connect to the server: net/http: TLS handshake timeout

Where can I see the kubectl logs?

I am on Mac OS High Sierra. Thank you for reading my post.



Solution 1:[1]

enter image description here

I increased the RAM to 8GB, CPUs to 4 and swap space to 4GB, restarted Docker For Mac. kubectl works fine now.

Solution 2:[2]

I had similar issue on two node cluster running Ubuntu server. My master node system time was set to wrong time and date. Which is causing issue with TLS handshake time out. After setting correct system time issue got resolved from me.

/etc/init.d/ntp stop

ntpdate <ntpserver_IP>

Thanks

Solution 3:[3]

To see additional logs you may try "--v=N" option, e.g:

kubectl get pods --all-namespaces --v=9

See https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-output-verbosity-and-debugging

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user674669
Solution 2 Jay
Solution 3 Maciek