mac安装启动minikube

1.brew安装minikube

cyl@cyldeMacBook-Pro ~ % brew install minikube

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/kubernetes-
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/minikube-1.
######################################################################## 100.0%
==> Installing dependencies for minikube: kubernetes-cli
==> Installing minikube dependency: kubernetes-cli
==> Pouring kubernetes-cli-1.19.2.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/kubernetes-cli/1.19.2: 231 files, 49MB
==> Installing minikube
==> Pouring minikube-1.13.0.catalina.bottle.1.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/minikube/1.13.0: 8 files, 62.2MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/cyl/Library/Logs/Homebrew/openssl@1.1... (64B)
Removing: /Users/cyl/Library/Logs/Homebrew/nmap... (64B)
Removing: /Users/cyl/Library/Logs/Homebrew/telnet... (64B)
Pruned 0 symbolic links and 2 directories from /usr/local
==> Caveats
==> kubernetes-cli
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> minikube
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

cyl@cyldeMacBook-Pro ~ % minikube
minikube provisions and manages local Kubernetes clusters optimized for
development workflows.

基本命令:
  start          Starts a local Kubernetes cluster
  status         Gets the status of a local Kubernetes cluster
  stop           Stops a running local Kubernetes cluster
  delete         Deletes a local Kubernetes cluster
  dashboard      Access the Kubernetes dashboard running within the minikube
cluster
  pause          pause Kubernetes
  unpause        恢复 Kubernetes

Images Commands:
  docker-env     Configure environment to use minikube's Docker daemon
  podman-env     Configure environment to use minikube's Podman service
  cache          Add, delete, or push a local image into minikube

配置和管理命令:
  addons         Enable or disable a minikube addon
  config         Modify persistent configuration values
  profile        Get or list the current profiles (clusters)
  update-context Update kubeconfig in case of an IP or port change

网络和连接命令:
  service        Returns a URL to connect to a service
  tunnel         Connect to LoadBalancer services

高级命令:
  mount          将指定的目录挂载到 minikube
  ssh            Log into the minikube environment (for debugging)
  kubectl        Run a kubectl binary matching the cluster version
  node           Add, remove, or list additional nodes

故障排除命令ƒ
  ssh-key        检索指定集群的 ssh 密钥路径
  ip             检索正在运行的群集的 IP 地址
  logs           Returns logs to debug a local Kubernetes cluster
  update-check   打印当前和最新版本版本
  version        打印 minikube 版本

Other Commands:
  completion     Generate command completion for a shell

Use "minikube <command> --help" for more information about a given command.

2.启动minikube

cyl@cyldeMacBook-Pro ~ % minikube start
😄  Darwin 10.15.6 上的 minikube v1.13.0
✨  Automatically selected the vmwarefusion driver
💿  正在下载 VM boot image...
🎉  minikube 1.16.0 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.16.0
💡  To disable this notice, run: 'minikube config set WantUpdateNotification false'

    > minikube-v1.13.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.13.0.iso: 173.73 MiB / 173.73 MiB [] 100.00% 8.82 MiB p/s 20s
👍  Starting control plane node minikube in cluster minikube
💾  Downloading Kubernetes v1.19.0 preload ...
    > preloaded-images-k8s-v6-v1.19.0-docker-overlay2-amd64.tar.lz4: 486.28 MiB
❗  The vmwarefusion driver is deprecated and support for it will be removed in a future release.
            Please consider switching to the new vmware unified driver, which is intended to replace the vmwarefusion driver.
            See https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/ for more information.
            To disable this message, run [minikube config set ShowDriverDeprecationNotification false]
🔥  Creating vmwarefusion VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
❗  This VM is having trouble accessing https://k8s.gcr.io
💡  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/

🐳  正在 Docker 19.03.12 中准备 Kubernetes v1.19.0…
E0101 07:56:20.585153    3133 start.go:99] Unable to get host IP: HostIP not yet implemented for "vmwarefusion" driver

❌  Exiting due to GUEST_START: Failed to setup kubeconfig: HostIP not yet implemented for "vmwarefusion" driver

😿  If the above advice does not help, please let us know: 
👉  https://github.com/kubernetes/minikube/issues/new/choose

错误信息:

❗ The vmwarefusion driver is deprecated and support for it will be removed in a future release.
            Please consider switching to the new vmware unified driver, which is intended to replace the vmwarefusion driver.
            See https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/ for more information.
            To disable this message, run [minikube config set ShowDriverDeprecationNotification false]

❗  This VM is having trouble accessing https://k8s.gcr.io
💡  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/

🐳  正在 Docker 19.03.12 中准备 Kubernetes v1.19.0…
E0101 07:56:20.585153    3133 start.go:99] Unable to get host IP: HostIP not yet implemented for "vmwarefusion" driver

❌  Exiting due to GUEST_START: Failed to setup kubeconfig: HostIP not yet implemented for "vmwarefusion" driver

*翻译一下:

说vmwarefusion的驱动已被压制,在未来的版本中将被移除,请考虑切换到新的vmware unified驱动,其是用来替换vmwarefusion驱动的。具体参考:https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/ 
想要屏蔽这个提示信息,可运行 [minikube config set ShowDriverDeprecationNotification false]命令。*
vm在访问 https://k8s.gcr.io遇到了麻烦。
为了拉取新的外部镜像,你可能需要配置一个代理:[https://minikube.sigs.k8s.io/docs/reference/networking/proxy/](https://minikube.sigs.k8s.io/docs/reference/networking/proxy/)
不能获取主机IP:主机IP还没有为vmwarefusion驱动实现。
将退出,由于gueststart:已失败由于设置kubeconfig:主机IP还没有为vmwarefusion驱动实现。

解决方法:按照提示那么我们就参考:https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/
看有没有解决的方法。果然给出了方法。

安装docker-machine-driver-vmware

cyl@cyldeMacBook-Pro ~ % brew install docker-machine-driver-vmware

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/docker-machine-0.16.2.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/docker-machine-driver-vmware-0.1.1.catalina.bottle
######################################################################## 100.0%
==> Installing dependencies for docker-machine-driver-vmware: docker-machine
==> Installing docker-machine-driver-vmware dependency: docker-machine
==> Pouring docker-machine-0.16.2.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

To have launchd start docker-machine now and restart at login:
  brew services start docker-machine
Or, if you don't want/need a background service you can just run:
  docker-machine start
==> Summary
🍺  /usr/local/Cellar/docker-machine/0.16.2: 11 files, 36MB
==> Installing docker-machine-driver-vmware
==> Pouring docker-machine-driver-vmware-0.1.1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/docker-machine-driver-vmware/0.1.1: 5 files, 11.6MB
==> Caveats
==> docker-machine
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

To have launchd start docker-machine now and restart at login:
  brew services start docker-machine
Or, if you don't want/need a background service you can just run:
  docker-machine start

再次以vmware启动:minikube start --driver=vmware

cyl@cyldeMacBook-Pro ~ % minikube start --driver=vmware
😄  Darwin 10.15.6 上的 minikube v1.13.0
✨  根据用户配置使用 vmware 驱动程序
👍  Starting control plane node minikube in cluster minikube
🔥  Creating vmware VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
❗  This VM is having trouble accessing https://k8s.gcr.io
💡  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
🐳  正在 Docker 19.03.12 中准备 Kubernetes v1.19.0…
🔎  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
🏄  Done! kubectl is now configured to use "minikube" by default

查看已运行:

cyl@cyldeMacBook-Pro ~ % kubectl cluster-info
Kubernetes master is running at https://192.168.60.167:8443
KubeDNS is running at https://192.168.60.167:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

也可ssh连到节点:

cyl@cyldeMacBook-Pro ~ % minikube ssh
                         _             _            
            _         _ ( )           ( )           
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __  
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

最后,补全kubectl命令,执行如下两个命令即可。

cyl@cyldeMacBook-Pro ~ % brew info bash-completion
bash-completion: stable 1.3 (bottled)
Programmable completion for Bash 3.2
https://salsa.debian.org/debian/bash-completion
Conflicts with:
  bash-completion@2 (because each are different versions of the same formula)
/usr/local/Cellar/bash-completion/1.3_3 (189 files, 607.9KB) *
  Poured from bottle on 2021-01-01 at 09:00:24
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/bash-completion.rb
==> Caveats
Add the following line to your ~/.bash_profile:
  [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Analytics
install: 8,232 (30 days), 27,163 (90 days), 128,163 (365 days)
install-on-request: 7,561 (30 days), 24,234 (90 days), 117,568 (365 days)
cyl@cyldeMacBook-Pro ~ % kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl

输入ku按下tab显示已补全:

cyl@cyldeMacBook-Pro ~ % ku
kuaishou.sh*  kubectl
cyl@cyldeMacBook-Pro ~ % kubectl get pods -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system   coredns-f9fd979d6-plgpp            1/1     Running   0          18m
kube-system   etcd-minikube                      1/1     Running   0          18m
kube-system   kube-apiserver-minikube            1/1     Running   0          18m
kube-system   kube-controller-manager-minikube   1/1     Running   0          18m
kube-system   kube-proxy-qtgkg                   1/1     Running   0          18m
kube-system   kube-scheduler-minikube            1/1     Running   0          18m
kube-system   storage-provisioner                1/1     Running   1          18m

完毕!

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,125评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,293评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,054评论 0 351
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,077评论 1 291
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,096评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,062评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,988评论 3 417
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,817评论 0 273
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,266评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,486评论 2 331
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,646评论 1 347
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,375评论 5 342
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,974评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,621评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,796评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,642评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,538评论 2 352

推荐阅读更多精彩内容