kubectl: error: The gcp auth plugin has been removed
What happened:
When I run kubectl get pods
I got the error:
error: The gcp auth plugin has been removed.
Please use the "gke-gcloud-auth-plugin" kubectl/client-go credential plugin instead.
See https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details
What expected to happen:
I should get the list of pods.
Environment:
- Kubernetes client and server versions (use
kubectl version
):
clientVersion:
buildDate: "2022-12-08T19:58:30Z"
compiler: gc
gitCommit: b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d
gitTreeState: clean
gitVersion: v1.26.0
goVersion: go1.19.4
major: "1"
minor: "26"
platform: linux/amd64
kustomizeVersion: v4.5.7
serverVersion:
buildDate: "2021-05-27T23:27:49Z"
compiler: gc
gitCommit: 132a687512d7fb058d0f5890f07d4121b3f0a2e2
gitTreeState: clean
gitVersion: v1.20.7
goVersion: go1.15.12
major: "1"
minor: "20"
platform: linux/amd64
WARNING: version difference between client (1.26) and server (1.20) exceeds the supported minor version skew of +/-1
- Cloud provider or hardware configuration: Google.
- OS (e.g:
cat /etc/os-release
):
LSB Version: core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID: Pop
Description: Pop!_OS 22.04 LTS
Release: 22.04
Codename: jammy
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 19 (1 by maintainers)
After installing the auth plugin
the solution for me was to first set the ENV variable
and then get the credentials
The following actions did the trick for me:
user@bastion-host:~$ echo 'export USE_GKE_GCLOUD_AUTH_PLUGIN=True' >> ~/.profile
user@bastion-host:~$ source ~/.profile
user@bastion-host:~$ cp ~/.kube/config ~/.kube/config.backup && rm ~/.kube/config
user@bastion-host:~$ gcloud container clusters get-credentials cluster-name --region your-region-here --project project-id
Check to see if “kubectl get node” works now. If not, continue with the following:
user@bastion-host:~$ nano ~/.kube/config
Modify the following “users” section, like so:
I removed and re-installed all
google-cloud-cli
,google-cloud-cli-gke-gcloud-auth-plugin
andkubectl
packages. I deleted.kube
configuration directory and re-imported the clusters: now it is working fine.Confirmed this solves the issue in macOS, thanks a lot @acola 👍
I have the same and the standard fix of setting
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
does not helphttps://stackoverflow.com/questions/74775557/how-to-use-gke-gcloud-auth-plugin-with-a-gcloud-service-account-key-file
Hi,
If this happens after an update, try to do the following:
echo 'export USE_GKE_GCLOUD_AUTH_PLUGIN=True' >> ~/.profile
source ~/.profile
cp ~/.kube/config ~/.kube/config.old
rm ~/.kube/config
gcloud container cluster get-credentials (...)
Since you added the variable to use the gke auth plugin, next time you get the config file via gcloud, you should get the correct format for usage with the gcloud auth plugin.
Hello, Thank you @ucsky! It worked also for me. I’ve created a bash script to do it easily. Hope it helps:
worked for me on macOS
This worked for me. Thanks.