Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubenetes: Error from server: the server does not allow access to the requested resource

I am following the hellonode tutorial, deploying to Google Container Engine, but running into the error below:

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)

Even though I am able to get the credential

gcloud container clusters get-credentials simplecluster

I get this problem, even when trying to get version info.

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

I did have to update my kubectl to 1.4.0, which matches the version of my cluster.

I have also initialized by gcloud with a config, and also did auth login.

Is there anything else that I can do?

like image 233
Henry Chang Avatar asked Dec 03 '22 14:12

Henry Chang


1 Answers

kubectl uses Application Default Credentials for authenticating to GKE clusters. It is possible that your Application Default Credentials are configured for a different user than your gcloud credentials if you have previously configured ADC.

Try running gcloud auth application-default login, and make sure that the GOOGLE_APPLICATION_CREDENTIALS environment variable isn't pointing somewhere unexpected.

like image 73
CJ Cullen Avatar answered Dec 31 '22 17:12

CJ Cullen