简体   繁体   English

如何使用 zsh 在 Mac M1 上安装 gke-gcloud-auth-plugin

[英]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.

相关问题 如何将 gke-gcloud-auth-plugin 与 gcloud 服务帐户密钥文件一起使用? - How to use gke-gcloud-auth-plugin with a gcloud service account key file? 如何在 Mac M1 上安装 Google Cloud DLP? - How to install Google Cloud DLP on Mac M1? 无法在 Mac M1 上执行 npm 全局安装 aws-azure-login - Unable to do npm global install of aws-azure-login on Mac M1 如何在 m1 上安装 x86/64 架构 pod - How to install x86/64 architecture pod on m1 Cocoapods M1 Mac 中Flutter 项目报错 - Cocoapods Error in Flutter Project in M1 Mac 如何安装或卸载 gcloud? - How to install or uninstall gcloud? 如何使用标准 Apple 版本的 clang 从命令行在 M1 Mac 上构建 Intel 二进制文件? - How to build an Intel binary on an M1 Mac from the command line with the standard Apple version of clang? 如何在不使用 gcloud CLI 的情况下向 GKE 集群进行身份验证 - How to authenticate to a GKE cluster without using the gcloud CLI 如何在 GKE 中使用 ReadWriteMany 创建持久卷声明? - How do I create a persistent volume claim with ReadWriteMany in GKE? 如何使用 cloudarmor 为我的 gke ingress 配置 DDoS? - How do I configure DDoS with cloudarmor for my gke ingress?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM