Skip to content
Posted on:May 12, 2023 at 04:00 PM

How to remove "the gcp auth plugin is deprecated in v1.22+"

How to remove "the gcp auth plugin is deprecated in v1.22+"

Problem

  • Everytime we run the kubectl or helm commands, you’d get this warning:
➜  ~ kubectl get po
W0511 14:48:33.482892   92730 gcp.go:119] WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.26+; use gcloud instead.
To learn more, consult https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
NAME                       READY   STATUS    RESTARTS   AGE
dna-api-567c55556c-299z4   2/2     Running   0          3h41m
dna-api-567c55556c-w2np6   2/2     Running   0          3h42m

Solutions: 3 steps

See this

  1. Install gke-gcloud-auth-plugin
gcloud components install gke-gcloud-auth-plugin

To verify if it’s installed properly.

➜  ~ gke-gcloud-auth-plugin --version
Kubernetes v1.26.2-alpha+038d2342e9672c4772e9ee48a3f1dd9438156eba
  1. Add the environment varialbe in your shell. Add this block in .zshrc or .bashrc
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
  1. Update the configuration for the cluster
gcloud container clusters get-credentials CLUSTER_NAME

If you have dev, stage and prod environment, we’d have to run it in all environments

➜  ~ gcloud projects list
PROJECT_ID      NAME            PROJECT_NUMBER
mycom-dev        mycom-dev        268984123123
mycom-prod       mycom-prod       272871231238
mycom-stage      mycom-stage      921231231276

➜  ~ gcloud config set project mycom-dev
Updated property [core/project].

➜  ~ gcloud container clusters list
NAME                      LOCATION         MASTER_VERSION   MASTER_IP      MACHINE_TYPE    NODE_VERSION      NUM_NODES  STATUS
mycom-dev-asia-northeast1  asia-northeast1  1.23.17-gke.300  34.146.82.235  n2d-standard-4  1.23.17-gke.300   6          RUNNING
mycom-dev-us-central1      us-central1      1.23.17-gke.300  34.71.62.97    n2d-standard-4  1.22.8-gke.200 *  37         RUNNING

➜  ~ gcloud container clusters get-credentials mycom-dev-us-central1
Fetching cluster endpoint and auth data.
kubeconfig entry generated for mycom-dev-us-central1.

Repeat this for stage and prod

Web Analytics