Error “certificate signed by unknown authority” after switching GCP project

不问归期 提交于 2019-12-10 13:49:15

问题


After switching gcloud projects using ...

gcloud init

... and then try to do some kubectl command, like this for instance:

kubectl get rc

... I get this error:

error: couldn't read version from server: Get
https://130.211.59.254/api: x509: certificate signed by unknown authority

Why is this and how can I solve it?


回答1:


This is because the keys to your old cluster is cached. I'm not sure why they are not updated by the gcloud init command (that's what one would intuitively expect, or at least some kinder error message from kubectl)

You solve it by simply getting the credentials of the cluster in the new configuration:

gcloud container clusters get-credentials YOURCLUSTERHERE --zone YOURCLUSTERZONEHERE



回答2:


This can be resolved by fetching the credential

gcloud container clusters get-credentials   < container-cluster >    --zone < zone >  --project   < project name >

Or

login to GCP

GCP -> container engine -> container clusters -> connect to cluster

Refer this docs for further information

https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials




回答3:


step 1: Remove .kube/config file

step 2: gcloud container clusters get-credentials YOURCLUSTERHERE

Still, if you facing issue, then disconnect with your current orgnization network and try with mobile hotspot or your wifi.



来源:https://stackoverflow.com/questions/36029270/error-certificate-signed-by-unknown-authority-after-switching-gcp-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!