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

Google compute engine 默认情况下,kubectl未安装在GCE上,google-compute-engine,google-kubernetes-engine,Google Compute Engine,Google Kubernetes Engine,接下来,我将尝试从Google Compute Engine上的另一台机器管理Google容器引擎集群。以下是我的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

接下来,我将尝试从Google Compute Engine上的另一台机器管理Google容器引擎集群。以下是我的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.

正如你们所看到的,我的谷歌云SDK似乎是最新的,但仍然不能在GCE上正常工作。有什么我不知道的吗?

你可以从这个谷歌云存储URL下载当前版本的kubectl二进制文件:

如果你已经运行了将在你的系统上安装kubectl二进制文件的
gcloud components update
,它就不会出现在你的路径上。它将位于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
安装kubectl的正确方法现在是
gcloud组件安装kubectl

  • 您必须已安装
  • 有关进一步信息
截至(至少)138.0.0(2016年11月)

现在是gcloud组件安装kubectl

这是在运行时:

您当前的云SDK版本是:138.0.0

以下是相关说明:

To install or remove components at your current SDK version [138.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [141.0.0], run:
  $ gcloud components update

Robert,您能否安排更改
gcloud alpha容器kubectl create的输出
,因为
运行“gcloud组件更新预览”
有点误导?您运行的是哪个版本的gcloud?当前版本(0.9.61)现在显示
运行“gcloud组件更新”,或者确保kubectl安装在您路径上的某个位置。
。我收到了相同的消息。问题是这有点误导。对我来说,消息中的
意味着运行更新就足够了。所以我甚至没有尝试将kubectl添加到path。因此,我建议将
替换为
,同样
在我的情况下,在Linux Mint 18上,我安装了gcloud,安装了带有“gcloud components update kubectl”的kubectl,但在终端上仍然不可用。我创建了一个指向/usr/bin/的符号链接,它在MacOS上运行,如果您使用
brew cask安装google cloud sdk
,安装了
google cloud sdk
,sdk的
bin
目录将位于
/usr/local/Caskroom/google cloud sdk/latest/google cloud sdk/bin/
Daniel感谢您的回答。您是否可以提供关于您所引用的GCE版本的文档,以便此答案能够持续一段时间,并在以后的日子内被理解?此文档将在您安装sdk的bin文件夹中的哪里安装
kubectl
binary?@Jatin