2016-10-06 33 views
4

我下面的hellonode教程,部署到谷歌集装箱引擎,但运行到下面的错误:Kubenetes:从服务器错误:服务器不允许访问所请求的资源

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登录。

还有什么我能做的吗?

回答

17

kubectl使用Application Default Credentials来验证GKE集群。如果您之前配置了ADC,那么可能会为您的应用程序默认凭证配置不同于gcloud凭证的用户。

尝试运行gcloud auth application-default login,并确保GOOGLE_APPLICATION_CREDENTIALS环境变量未指向意外的地方。

+0

是的,这工作,这确实是我GOOGLE_APPLICATION_CREDENTIALS指向别的东西。谢谢! –

+0

没问题!真高兴你做到了。 –

+6

完成上述操作后,我还需要重新运行'gcloud容器集群get-credentials'命令,但在使用新帐户登录后,一切正常,然后 – doogle

相关问题