Could not find default credentials

lang2 picture lang2 · Jan 6, 2017 · Viewed 27.6k times · Source

I'm playing with Google container engine on gcloud. So after successfully finished gloud init I followed instructions and did:

gcloud container clusters get-credentials cluster-1 --zone europe-west1-c --project whatever

And then:

kubectl proxy

But I got the following error message:

error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

I do see stuff in ~/.kube/config file so I'm not sure what went wrong. I have minikube also installed on the machine but I don't think that's a problem.

Answer

cherba picture cherba · Jan 6, 2017

Use

gcloud auth application-default login

to login for application default creadentials (docs). The behavior for application default credentials has changed in gcloud since version 128.

Note that changing credentials via gcloud auth login or gcloud init or gcloud config set account MY_ACCOUNT will NOT affect application default credentials, they managed separately from gcloud credentials.