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

时间:2015-05-04 12:04:55

标签: google-compute-engine google-kubernetes-engine

关注guide我尝试从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.

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

4 个答案:

答案 0 :(得分:18)

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

答案 1 :(得分:15)

如果您运行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

答案 2 :(得分:1)

您可以从此Google云端存储网址下载当前版本的kubectl二进制文件:https://storage.googleapis.com/kubernetes-release/release/v0.18.2/bin/linux/amd64/kubectl

答案 3 :(得分:1)

截至(至少)138。0。0(2016年11月)

现在gcloud components install kubectl

这是在运行时:

Your current Cloud SDK version is: 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