Utkarsh Sharma
Utkarsh Sharma

Reputation: 51

Google Kubernetes Get Credentials

I am using:

sudo gcloud container clusters get-credentials clustername --zone zone --project project_id

to get credentials in jenkins, this works in GCP jenkins shell.

While migrating to AWS I have setup new jenkins where I am using same command (with same parameters ) but there it fails with error code :

(gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Required "container.clusters.get" permission(s) 

Same thing happens when I run in my local machine.

PS : I am logged into gcloud with a different GCP account from the one in command

Could help me figure out the issue

Upvotes: 1

Views: 1058

Answers (2)

Utkarsh Sharma
Utkarsh Sharma

Reputation: 51

'Could you run gcloud auth list and compare the results', suggestion by Mario helped

The Jenkins user was reflecting the authentication made in shell, fixing that solved the issue

Upvotes: 1

Alex G
Alex G

Reputation: 1279

You have to make sure that the service account you are using has the roles needed for container.clusters.get. You can check this link on how you can do that.

If you are still receiving an error, you can create a new service account, then grant the same roles needed for it.

Upvotes: 1

Related Questions