2016-10-06 37 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

相關問題