tonglin0325的个人主页

Mac下安装minikube

1.安装kubectl命令#

1
2
brew install kubectl

如果想安装指定版本的kubectl

1
2
3
4
5
curl -LO "https://dl.k8s.io/release/v1.20.0/bin/darwin/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl

验证版本,会打印出client端和server端的版本,官方建议2个版本直接版本相差不要大于+/-1

1
2
3
4
kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"132a687512d7fb058d0f5890f07d4121b3f0a2e2", GitTreeState:"clean", BuildDate:"2021-05-12T12:32:49Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}

  

2.下载和安装minikube#

1
2
3
4
5
6
7
8
9
➜  /Users/lintong/Downloads $ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 68.6M 100 68.6M 0 0 9365k 0 0:00:07 0:00:07 --:--:-- 11.0M
➜ /Users/lintong/Downloads $ sudo install minikube-darwin-amd64 /usr/local/bin/minikube

Password:

参考

1
2
https://minikube.sigs.k8s.io/docs/start/

如果要安装指定版本的话,请到下面的地址下载

1
2
https://github.com/kubernetes/minikube/releases

比如安装v1.21.0版本

1
2
3
curl -LO https://github.com/kubernetes/minikube/releases/download/v1.21.0/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube

卸载minikube

1
2
3
minikube delete
rm -rf ~/.minikube

  

3.安装virtualbox#

1
2
brew install virtualbox

  

4.使用virtualbox来启动minikube集群#

参考:在Mac上基于virtualbox安装minikube

 

1
2
minikube start --memory=4096 --driver=virtualbox

如果报 Vagrant up failing for VirtualBox provider with E_ACCESSDENIED on host-only network,则添加 /etc/vbox/networks.conf 文件,如下

1
2
192.0.0.0/8

且保证在mac的 System Preferences -> Security & Privacy -> Allow -> Then allow the software corporation (in this case Oracle)

 

5.使用请参考:ubuntu16.04安装minikube