本文介绍了错误“由未知授权机构签名的证书";切换GCP项目后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用...切换gcloud项目后

After switching gcloud projects using ...

gcloud init

...然后尝试执行一些kubectl命令,例如:

... 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?

推荐答案

这是因为缓存了旧群集的密钥.我不确定为什么gcloud init命令不会更新它们(这是人们的直觉期望,或者至少是来自kubectl的一些更错误的消息)

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

这篇关于错误“由未知授权机构签名的证书";切换GCP项目后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:03