How to use gke-gcloud-auth-plugin with a gcloud service account key file?

Hello there,

In CI, with gcp auth plugin I was using gcloud auth activate-service-account ***@developer.gserviceaccount.com --key-file ***.json prior to execute kubectl commands.
Now with gke-gcloud-auth-plugin I can’t find any equivalent to use a gcp service account key file.
I’ve installed gke-gcloud-auth-plugin and gke-gcloud-auth-plugin --version is giving me Kubernetes v1.25.2-alpha+ae91c1fc0c443c464a4c878ffa2a4544483c6d1f
Would you know if there’s a way?

I tried to add this command:
kubectl config set-credentials my-user --auth-provider=gcp
But I still get:

error: The gcp auth plugin has been removed. Please use the "gke-gcloud-auth-plugin" kubectl/client-go credential plugin instead.

Just as they told you in StackOverflow, the USE_GKE_GCLOUD_AUTH_PLUGIN is still needed in Kubernetes 1.26, even if the docs seemed to indicate it was only to opt-in during the previous releases.

So the solution is to add something like this:

export USE_GKE_GCLOUD_AUTH_PLUGIN=True

Before issuing the gcloud container clusters get-credentials ... command.

Hi, I am facing the same problem.

I have exported the variable

and issued the command

gcloud container clusters get-credentials CLUSTER_NAME

but still get the same error

error: The gcp auth plugin has been removed.
Please use the "gke-gcloud-auth-plugin" kubectl/client-go credential plugin instead.

gke-gcloud-auth-plugin --version gives Kubernetes v1.25.2-alpha+ae91c1fc0c443c464a4c878ffa2a4544483c6d1f