默认情况下,kubectl未安装在GCE上

Ole*_*kyi 5 google-compute-engine google-kubernetes-engine

按照指南,我试图从Google Compute Engine上的另一台计算机管理Google Container Engine集群.这是我的GCE实例的输出:

oleksandr_berezianskyi_gmail_com@docker-managed-jenkins:~$ sudo gcloud components update preview
All components are up to date.
oleksandr_berezianskyi_gmail_com@docker-managed-jenkins:~$ sudo gcloud components update alpha
All components are up to date.
oleksandr_berezianskyi_gmail_com@docker-managed-jenkins:~$ gcloud alpha container kubectl create -f cassandra.yaml
ERROR: (gcloud.alpha.container.kubectl) This command requires the kubernetes client (kubectl), which is installed with the gcloud preview component. Run 'gcloud components update preview', or make sure kubectl is installed somewhere on your
 path.
Run Code Online (Sandbox Code Playgroud)

如您所见,我的Google Cloud SDK似乎是最新的,但仍无法在GCE上正常运行.有什么我想念的吗?

Tom*_*Kay 19

现在正是安装kubectl的正确方法 gcloud components install kubectl

  • 这在哪里安装`kubectl`二进制文件? (2认同)

Rob*_*ley 16

如果你已经运行gcloud components update了将在你的系统上安装kubectl二进制文件,它就不会在你的路径中.它将位于cloud-sdk安装目录中.您可以通过运行手动将其添加到路径中

export PATH=$PATH:/usr/local/share/google/google-cloud-sdk/bin/

或者您可以从路径中已有的目录创建符号链接,例如/usr/local/bin通过运行

sudo ln -s /usr/local/share/google/google-cloud-sdk/bin/kubectl /usr/local/bin/kubectl

  • 在MacOS上,如果你使用`brew cask install google-cloud-sdk`安装`google-cloud-sdk`,sdk的`bin`目录将位于`/ usr/local/Caskroom/google-cloud-sdk/latest /谷歌云-SDK /斌/` (5认同)