23

I try to install gke-gcloud-auth-plugin on a Mac M1 with zsh, following the gcloud docs.

The installation ran without issue and trying to re-run gcloud components install gke-gcloud-auth-plugin I get the All components are up to date. message.

However, gke-gcloud-auth-plugin --version returns zsh: command not found: gke-gcloud-auth-plugin. kubectl, installed the same way, works properly.

I tried to install kubectl using brew, with no more success.

Amiel
  • 261
  • 1
  • 2
  • 7

3 Answers3

30

I had the same error and here's how I fixed it.

brew info google-cloud-sdk

which produces:

To add gcloud components to your PATH, add this to your profile:

  for bash users
    source "$(brew --prefix)/share/google-cloud-sdk/path.bash.inc"

  for zsh users
    source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"
    source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc"

  for fish users
    source "$(brew --prefix)/share/google-cloud-sdk/path.fish.inc"

Grab the code for your terminal and then run it (e.g., for zsh)

source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"

Add the above line to your .zshrc profile to make sure that it is loaded every time you open a new terminal.

I had originally installed gcloud sdk with homebrew brew install google-cloud-sdk. At that time, I read the Caveats, which tell you how to add gcloud components to your PATH.

I installed both kubectl and gke-gcloud-auth-plugin, and neither of them could be found from the command line. I got the same error as the OP "command not found"

sebastian
  • 2,386
  • 26
  • 22
LHWizard
  • 2,121
  • 19
  • 30
23
gcloud components install gke-gcloud-auth-plugin

here we go: enter image description here

Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
6

Not sure if it is the same on macOS. Can you try the following:

export USE_GKE_GCLOUD_AUTH_PLUGIN=True

Then reload the Cluster with

gcloud container clusters get-credentials clustername

Guess it is installed but just not used.

Maybe you just need to add the directory where to find your gke-gcloud-auth-plugin file to your PATH.

Is it working when you call it wirh absolute path?

path/to/gke-gcloud-auth-plugin --version

to find the file use the following command:

sudo find / -name gke-gcloud-auth-plugin
  • Thank you, I tried but it did not work. I also assume that this could be solved using the absolute path - but this is the point: I have no idea where it is installed. I noticed that it is not the same one for all the gcloud components. `kubectl` was installed in `/usr/local/bin/kubectl` for instance. – Amiel Oct 31 '22 at 15:19
  • Try: sudo find / -name gke-gcloud-auth-plugin – enceladus2022 Nov 01 '22 at 16:37
  • 1
    Thank you ! I found it this way and I created a symbolic link to a folder my PATH. Everything works now. I accepted your answer, but how can I make your suggestion n the comments more visible? – Amiel Nov 02 '22 at 08:03
  • Happy to hear it helped. I will add it in my answer. Thanks – enceladus2022 Nov 02 '22 at 12:10