首页 文章

Kubenetes:来自服务器的错误:服务器不允许访问所请求的资源

提问于
浏览
4

我正在关注hellonode教程,部署到Google容器引擎,但遇到以下错误:

kubectl run simple-gke-server --image=us.gcr.io/cloud-assets-henry/simple-gke-server:v1 --port=8888

Error from server: the server does not allow access to the requested resource (post replicationcontrollers)

即使我能够获得凭证

gcloud container clusters get-credentials simplecluster

即使在尝试获取版本信息时,我也遇到了这个问题 .

kubectl version

Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.0", GitCommit:"a16c0a7f71a6f93c7e0f222d961f4675cd97a46b", GitTreeState:"clean", BuildDate:"2016-09-26T18:16:57Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"darwin/amd64"}

Couldn't read server version from server: the server does not allow access to the requested resource

我必须将我的kubectl更新到1.4.0,这与我的集群版本相匹配 .

我也用gcloud初始化了一个配置,并且还进行了auth登录 .

还有什么我可以做的吗?

1 回答

  • 17

    kubectl使用Application Default Credentials对GKE集群进行身份验证 . 如果先前已配置ADC,则可能会为与gcloud凭据不同的用户配置应用程序默认凭据 .

    尝试运行 gcloud auth application-default login ,并确保 GOOGLE_APPLICATION_CREDENTIALS 环境变量未指向某处意外 .

相关问题