[英]How do I install gke-gcloud-auth-plugin on a Mac M1 with zsh
I try to install gke-gcloud-auth-plugin
on a Mac M1 with zsh, following the gcloud docs .我尝试按照 gcloud 文档在带有 zsh 的 Mac M1 上安装gke-gcloud-auth-plugin
。
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.
安装运行没有问题,并尝试重新运行gcloud components install gke-gcloud-auth-plugin
我得到All components are up to date.
message.信息。
However, gke-gcloud-auth-plugin --version
returns zsh: command not found: gke-gcloud-auth-plugin
.但是, gke-gcloud-auth-plugin --version
返回zsh: command not found: gke-gcloud-auth-plugin
。 kubectl
, installed the same way, works properly. kubectl
以同样的方式安装,可以正常工作。
I tried to install kubectl
using brew
, without no more success.我尝试使用brew
安装kubectl
,但没有成功。
I had the same error and here's how I fixed it.我有同样的错误,这是我修复它的方法。
I had originally installed gcloud sdk with homebrew brew install google-cloud-sdk
.我最初使用 homebrew brew install google-cloud-sdk
安装了 gcloud sdk 。 At that time, I read the Caveats, which tell you how to add gcloud components to your PATH by adding the following line to your profile:那时,我阅读了 Caveats,它告诉您如何通过将以下行添加到您的配置文件来将 gcloud 组件添加到您的 PATH:
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
I installed both kubectl and gke-gcloud-auth-plugin, and neither of them could be found from the command line. kubectl和gke-gcloud-auth-plugin我都安装了,命令行都找不到。 I got the same error as the OP "command not found"我得到了与 OP“找不到命令”相同的错误
A page I was reading said that you can view the Caveats by typing brew info google-cloud-sdk
我正在阅读的一个页面说您可以通过键入brew info google-cloud-sdk
查看注意事项
Lo and Behold, the completion line for zsh users has changed!瞧,zsh 用户的完成行已经改变了!
To add gcloud components to your PATH, add this to your profile:
for bash users
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
for zsh users
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
for fish users
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.fish.inc"```
I updated the line in .zshrc and now it all works.
Not sure if it is the same on macOS.不确定它在 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
.也许您只需要将找到gke-gcloud-auth-plugin
文件的目录添加到您的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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.