When I am authenticating using service-account.json I am not able to access any projects, i.e. the command 'gcloud projects list' results in
Listed 0 items.
Setting gcloud project using the command 'gcloud config set project my-project' results in:
WARNING: You do not appear to have access to project [my-project] or it does not exist.
But this project is present in my service-account.json I am trying to get my GKE cluster credentials to create a kubeconfig entry. 'gcloud container clusters get-credentials my-cluster --zone=us-central1-a'
ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Required "container.clusters.get" permission(s) for "projects/my-project/zones/us-central1-a/clusters/my -cluster".
When I log in to GCP using gcloud init and logging in with user account all these steps are giving successful results. But how should I authorise user account without opening browser. I cannot use '--console-only' flag as it still requires to copy-paste url and opening browser. I want to automate the full process of authenticating to user account by only using scripts
NOTE: The my-cluster GKE cluster was created under my-project and was created by me.