打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Kubernetes 环境搭建 - MacOS

准备工作

1、Mac 环境需求

Minikube 要求在 BIOS 中启用 VT-x / AMD-v 虚拟化, 要检查这是否在OSX / macOS上运行,请执行以下操作:

  1. sysctl -a | grep machdep.cpu.features | grep VMX

如果有输出,那你很棒棒!

2、【推荐】使用清华的 brew 镜像源

  1. cd '$(brew --repo)'

  2. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

  3. cd '$(brew --repo)/Library/Taps/homebrew/homebrew-core'

  4. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

  5. brew update

相关软件安装

  • kubectl

  • docker (for Mac)

  • minikube

  • virtualbox

  1. brew update && brew install kubectl && brew cask install docker minikube virtualbox

校验软件版本信息

  1. docker --version                # Docker version 18.03.1-ce, build 9ee9f40

  2. docker-compose --version        # docker-compose version 1.21.1, build 5a3f1a3

  3. docker-machine --version        # docker-machine version 0.14.0, build 89b8332

  4. minikube version                # minikube version: v0.26.1

  5. kubectl version --client        # Client Version: version.Info{Major:'1', Minor:'10', GitVersion:'v1.10.1', GitCommit:'d4ab47518836c750f9949b9e0d387f20fb92260b', GitTreeState:'clean', BuildDate:'2018-04-13T22:28:25Z', GoVersion:'go1.9.5', Compiler:'gc', Platform:'darwin/amd64'}

开始

1、启动 kubernetes 集群

  1. minikube start --bootstrapper=localkube

一会后,会有如下输出

  1. Starting local Kubernetes v1.10.0 cluster...

  2. Starting VM...

  3. Downloading Minikube ISO

  4. 150.53 MB / 150.53 MB [============================================] 100.00% 0s

  5. Getting VM IP address...

  6. WARNING: The localkube bootstrapper is now deprecated and support for it

  7. will be removed in a future release. Please consider switching to the kubeadm bootstrapper, which

  8. is intended to replace the localkube bootstrapper. To disable this message, run

  9. [minikube config set ShowBootstrapperDeprecationNotification false]

  10. Moving files into cluster...

  11. Downloading localkube binary

  12. 173.54 MB / 173.54 MB [============================================] 100.00% 0s

  13. 0 B / 65 B [----------------------------------------------------------]   0.00%

  14. 65 B / 65 B [======================================================] 100.00% 0sSetting up certs...

  15. Connecting to cluster...

  16. Setting up kubeconfig...

  17. Starting cluster components...

  18. Kubectl is now configured to use the cluster.

  19. Loading cached images from config file.

恭喜!Minikube 为你启动了一个虚拟机,并在该虚拟机中运行了 Kubernetes 集群。

2、查看集群节点信息

  1.  ~ kubectl get nodes

  2. NAME       STATUS    ROLES     AGE       VERSION

  3. minikube   Ready        15m       v1.10.0

常见问题及解决办法

1、kubectl 安装失败

  1. brew install kubectl

  2. Updating Homebrew...

  3. ==> Auto-updated Homebrew!

  4. Updated 2 taps (caskroom/cask, homebrew/core).

  5. ==> Updated Formulae

  6. pandoc-citeproc                                                   php                                                               php@7.0

  7. Error: Failed to link all completions, docs and manpages:

  8.  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)

  9. Warning: kubernetes-cli 1.10.1 is already installed, it's just not linked

  10. You can use `brew link kubernetes-cli` to link this version.

解决办法

  1. sudo chown -R $(whoami) /usr/local/share/

  2. brew link kubernetes-cli


推荐:Kubernetes API 使用指南

上一篇:译:尝试使用Spring WebFlux




最好的赞赏

就是你的关注


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
[原创]Dapr入门教程之二:Dapr的安装
k8s学习笔记(搭建&部署helloworld应用)
基于Kubernetes和Docker构建微服务之路
Kubernetes中设置HPA弹性伸缩Redis Cluster
手把手教你用 Flask,Docker 和 Kubernetes 部署Python机器学习模型(附代...
K8S太火了!花10分钟玩转它不香么?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服