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 恢復(fù) 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
網(wǎng)絡(luò)和連接命令:
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 檢索正在運(yùn)行的群集的 IP 地址
logs Returns logs to debug a local Kubernetes cluster
update-check 打印當(dāng)前和最新版本版本
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 中準(zhǔn)備 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
錯(cuò)誤信息:
? 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 中準(zhǔn)備 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的驅(qū)動已被壓制员帮,在未來的版本中將被移除,請考慮切換到新的vmware unified驅(qū)動,其是用來替換vmwarefusion驅(qū)動的。具體參考:https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/
想要屏蔽這個(gè)提示信息,可運(yùn)行 [minikube config set ShowDriverDeprecationNotification false]命令纱烘。*
vm在訪問 https://k8s.gcr.io遇到了麻煩。
為了拉取新的外部鏡像,你可能需要配置一個(gè)代理:[https://minikube.sigs.k8s.io/docs/reference/networking/proxy/](https://minikube.sigs.k8s.io/docs/reference/networking/proxy/)
不能獲取主機(jī)IP:主機(jī)IP還沒有為vmwarefusion驅(qū)動實(shí)現(xiàn)裂七。
將退出,由于gueststart:已失敗由于設(shè)置kubeconfig:主機(jī)IP還沒有為vmwarefusion驅(qū)動實(shí)現(xiàn)仓坞。
解決方法:按照提示那么我們就參考: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
? 根據(jù)用戶配置使用 vmware 驅(qū)動程序
?? 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 中準(zhǔn)備 Kubernetes v1.19.0…
?? Verifying Kubernetes components...
?? Enabled addons: default-storageclass, storage-provisioner
?? Done! kubectl is now configured to use "minikube" by default
查看已運(yùn)行:
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連到節(jié)點(diǎn):
cyl@cyldeMacBook-Pro ~ % minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
最后无埃,補(bǔ)全kubectl命令徙瓶,執(zhí)行如下兩個(gè)命令即可。
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顯示已補(bǔ)全:
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
完畢嫉称!