Ubuntu 22.04.4 LTS -> `kubectl version` times out with: Unable to connect to the server: net/http: TLS handshake timeout

Cluster information:

Kubernetes version: Google Cloud version
Cloud being used: Google Cloud
Installation method:
Host OS: Goolgle Cloud-hosted

My workstation:

  • Ubuntu 22.04.4 LTS
  • Client Version: version.Info{Major:“1”, Minor:“27+”, GitVersion:“v1.27.13-dispatcher”, GitCommit:“2632c48320ca08c72387a6e291ec482e2aca4adf”, GitTreeState:“clean”, BuildDate:“2024-05-06T06:39:51Z”, GoVersion:“go1.21.9”, Compiler:“gc”, Platform:“linux/amd64”}
  • Kustomize Version: v5.0.1
gke-gcloud-auth-plugin --version
Kubernetes v1.28.2-alpha+58ec6ae34b7dcd9699b37986ccb12b3bbac88f00

The cluster I’m using was set up by our devops team so I have no control over that. I’m using a Linux workstation and, after following these directions to install kubectl and configure my cluster access, I tried to verify that everything was in order by running the following command as recommended by the aforementioned guide:

kubectl get namespaces

Which spat out:

E0724 13:46:29.713742  909751 memcache.go:265] couldn't get current server API group list: Get "https://REDACTED/api?timeout=32s": net/http: TLS handshake timeout

Repeatedly. I showed my $HOME/.kube/config to our devops manager, he told me everything looks right.

After reading other threads with similar subjects, I tried a variety of things to fix the problem (unsuccessfully) which include:

  • Setting $KUBE_CONFIG to $HOME/.kube/config (which is the correct path).
  • Ensuring permissions on the .kube directory and .kube/config file are correct.
  • Triple checking that I successfully logged in using gcloud auth login.

I’m at a point where I can’t access our kubernetes cluster at all because I can only get timeout messages. Increasing verbosity using kubectl --v=9 doesn’t help because the problem occurs during the TLS handshake, so no HTTP payload is present to examine.

I have to admit that this is pretty frustrating, given that I followed the official guide step by step to set up kubectl for use with gcloud. I successfully installed the gke-gcloud-auth-plugin. I also successfully ran gcloud container clusters get-credentials CLUSTER_NAME --region=COMPUTE_REGION, of course replacing CLUSTER_NAME to our cluster and COMPUTE_REGION to the region we use. That command succeeded and as I said before, the output looked good to our devops manager.

I’m at a loss here. Any help would be greatly appreciated. Thanks in advance!