无法连接到服务器:net/http:TLS 握手超时(从本地到 GCP 集群)

Unable to connect to the server: net/http: TLS handshake timeout (from local to GCP cluster)

我在同一个 google 项目中创建了两个 Kubernetes 集群。 上周我无法连接其中一个。

jascao@mac ~ % gcloud container clusters get-credentials my-test-cluster --region us-central1 --project ****
Fetching cluster endpoint and auth data.
kubeconfig entry generated for my-test-cluster.
jascao@mac ~ % kubectl get namespace
NAME              STATUS   AGE
consul            Active   27d

jascao@mac ~ % gcloud container clusters get-credentials my-test-cluster2 --region us-central1 --project ****
Fetching cluster endpoint and auth data.
kubeconfig entry generated for my-test-cluster2.
jascao@mac ~ % kubectl get namespace
Unable to connect to the server: net/http: TLS handshake timeout

我已经尝试了接下来的方法,但都不起作用

  1. 重启mac
  2. 添加docker的记忆。
  3. 删除 kubectl 配置并重新连接
  4. 重新登录

那么有谁知道如何解决这个问题吗?

这是kubectl 版本问题。 我用这个命令安装 kubectl

gcloud components install kubectl

但是gcloud最近没有提供最新版本,所以遇到了这个问题。 所以我卸载了 kubectl 并用 brew 重新安装了 kubectl 并解决了这个问题。