我刚刚尝试在macOS上安装kubectl,但最后得到警告:
$ sudo gcloud components install kubectl
Password:
Your current Cloud SDK version is: 236.0.0
Installing components from version: 236.0.0
┌─────────────────────────────────────────────────────────────────────┐
│ These components will be installed. │
├─────────────────────┬────────────────────────┬──────────────────────┤
│ Name │ Version │ Size │
├─────────────────────┼────────────────────────┼──────────────────────┤
│ kubectl │ 2018.09.17 │ < 1 MiB │
│ kubectl │ 1.10.7 │ 12.8 MiB │
└─────────────────────┴────────────────────────┴──────────────────────┘
For the latest full release notes, please visit:
https://cloud.google.com/sdk/release_notes
Do you want to continue (Y/n)? y
╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: kubectl ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: kubectl ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation ═╣
╚════════════════════════════════════════════════════════════╝
Performing post processing steps...done.
Update done!
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:
/usr/local/Cellar/kubernetes-cli/1.13.2/bin/kubectl
$
我不确定kubectl
中为什么有两个(不同版本),或者一个如何删除旧工具?
请告知。
答案 0 :(得分:0)
如https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-homebrew-on-macos所述,您使用gcloud安装了一个kubectl,并使用brew install kubernetes-cli
安装了一个(在Celler目录中)
您可以使用https://superuser.com/questions/273966/how-can-i-uninstall-using-homebrew之类的brew remove kubernetes-cli
删除Brew提供的kubectl
答案 1 :(得分:0)
brew安装的那个可能也是由于其他依赖关系,例如,如果您尝试了kubeless,那将在brew目录中安装了kubectl。您可以删除这些文件,或者按照警告所示,确保PATH不包括Brew安装的文件。