有较旧版本的Google Cloud Platform工具:Docker

时间:2018-12-03 15:58:17

标签: gcloud

更新gcloud后,我收到此警告,但是我该怎么做(我应该删除Docker)吗?

$.getJSON('/get_data', {}, 
    function(data) {
        console.log(JSON.parse(data.result)); 
    }

我的.zshrc中有这个文件:

WARNING:   There are older versions of Google Cloud Platform tools on your system PATH.
  Please remove the following to avoid accidentally invoking these old tools:

  /Applications/Docker.app/Contents/Resources/bin/kubectl

4 个答案:

答案 0 :(得分:3)

之所以会这样,是因为docker-for-mac为kubectl安装了一个bin,而gcloud-sdk也为gcloud components install kubectl安装了另一个bin。

我的建议是从gcloud卸载kubectl作为组件,从docker-for-mac覆盖符号链接,仅使用自制软件安装的bin。

尝试以下命令:

gcloud components remove kubectl

brew install kubernetes-cli

brew link --overwrite kubernetes-cli

答案 1 :(得分:3)

TLDR

/usr/local/bin/kubectl是Docker安装的链接:ls -l /usr/local/bin/kubectl => /usr/local/bin/kubectl -> /Applications/Docker.app/Contents/Resources/bin/kubectl。删除链接没有副作用,并且可以解决冲突:

rm /usr/local/bin/kubectl

正当化

与Docker提供的kubectl版本存在冲突,因此检查Docker文档必须说些什么是有意义的。 https://docs.docker.com/docker-for-mac/#kubernetes

提取:

  

在Mac版Docker桌面17.12 Edge(mac45)和更高版本以及18.06中   稳定(mac70)及更高版本,包括独立的Kubernetes服务器   在Mac上运行,以便您可以测试部署Docker   Kubernetes上的工作负载。

     

Kubernetes客户端命令kubectl已包含并配置为   连接到本地Kubernetes服务器。

     

....

     

如果kubectl安装了Homebrew或某些   其他方法,如果遇到冲突,请删除/usr/local/bin/kubectl

答案 2 :(得分:1)

这是我的情况,您可以参考。运行gcloud components update后,我收到以下警告:

  

警告:系统PATH上有较旧版本的Google Cloud Platform工具。     请删除以下内容,以避免意外调用这些旧工具:

     

/usr/local/Cellar/kubernetes-cli/1.10.2/bin/kubectl

我使用brew list

检查了此工具
☁  issue [master] brew list
coreutils       gdbm            git-lfs         icu4c           kops            kubectx         libpng          mtr             openssl         python@2        sqlite          tree            wxmac
erlang          geoip           git-redate      jpeg            kube-ps1        kubernetes-cli  libtiff         node            pcre            readline        telnet          watchman

因此,我卸载了kubernetes-cli及其依赖项kopskube-ps1kubectx

☁  issue [master] brew uninstall kops kube-ps1 kubectx
Uninstalling /usr/local/Cellar/kops/1.9.0... (5 files, 129.8MB)
Uninstalling /usr/local/Cellar/kube-ps1/0.6.0... (6 files, 29.0KB)
Uninstalling /usr/local/Cellar/kubectx/0.5.0... (12 files, 27.8KB)
☁  issue [master] brew uninstall kubernetes-cli
Uninstalling /usr/local/Cellar/kubernetes-cli/1.10.2... (178 files, 52.8MB)
☁  issue [master] gcloud components update

All components are up to date.

此警告已消失。

答案 3 :(得分:0)

我刚刚进入Docker文件的bin文件夹,并将kubectl移到了垃圾箱。