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/[email protected]... (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  --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

完毕!

你可能感兴趣的:(mac安装启动minikube)