Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud: The user does not have access to service account "default"

I attempting to use an activated service account scoped to create and delete gcloud container clusters (k8s clusters), using the following commands:

gcloud config configurations create my-svc-account \
   --no-activate \
   --project myProject


gcloud auth activate-service-account [email protected] \
   --key-file=/path/to/keyfile.json \
   --configuration my-svc-account

gcloud container clusters create a-new-cluster \
   --configuration my-svc-account \
   --project= my-project
   --zone "my-zone"

I always receive the error:

...ERROR: (gcloud.container.clusters.create) ResponseError: code=400, message=The user does not have access to service account "default".

How do I grant my-svc-account access to the default service account for GKE?

like image 377
DrMarshall Avatar asked Nov 01 '16 20:11

DrMarshall


People also ask

What is default service account in GCP?

Google APIs Service Agent By default, the account is automatically granted the project editor role on the project and is listed in the IAM section of Google Cloud console. This service account is only deleted when the project is deleted.

How do I check my GCP service account permissions?

Using GCP Console 03 Navigate to Cloud Identity and Access Management (IAM) dashboard at https://console.cloud.google.com/iam-admin/iam. 04 In the navigation panel, select IAM. 05 Choose the PERMISSIONS tab, then select View by MEMBERS to list all the member accounts created for the selected GCP project.


2 Answers

After talking to Google Support, the issue was that the service account did not have a "Service Account User" permissions activated. Adding "Service Account User" resolves this error.

like image 199
DrMarshall Avatar answered Sep 18 '22 14:09

DrMarshall


Add the following role to the service account who makes the operation:

Service Account User

Also see:

  • https://cloud.google.com/kubernetes-engine/docs/how-to/iam#service_account_user

  • https://cloud.google.com/iam/docs/service-accounts#the_service_account_user_role

  • https://cloud.google.com/iam/docs/understanding-roles

like image 25
Eyal Levin Avatar answered Sep 18 '22 14:09

Eyal Levin