Search code examples
kubernetesgoogle-cloud-platformcloudservice-accounts

GCP add serviceaccount permission to k8s cluster


I'm having an issue with a step within my pipeline, more exactly:

gcloud container clusters get-credentials $K8s_CLUSTER_NAME --zone=$GCLOUD_ZONE --project $GCLOUD_PROJECT_ID

Which returns:

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

I am not sure how to add permissions for this serviceaccount, currently I am using .json key for this serviceaccount in order to push images to gcr.io. Thx


Solution

  • Apparently the problem was that I've missed a role from that serviceaccount, more exactly:

    Kubernetes Engine Admin role

    enter image description here

    More info about the role:

    enter image description here