update minikube
parent
8e11f1cd7a
commit
23bc8e528d
|
@ -2,70 +2,65 @@
|
|||
|
||||
Minikube 用于在本地运行 kubernetes 环境,用来开发和测试。
|
||||
|
||||
## 在Mac上安装xhyve-driver
|
||||
## 安装 Minikube
|
||||
|
||||
```bash
|
||||
brew install docker-machine-driver-xhyve
|
||||
# docker-machine-driver-xhyve need root owner and uid
|
||||
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
|
||||
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
|
||||
```
|
||||
|
||||
到 https://github.com/kubernetes/minikube/releases 下载 minikube,我安装的是minikube v0.22.3
|
||||
到 https://github.com/kubernetes/minikube/releases 下载 minikube,我安装的是 minikube v1.11.0。
|
||||
|
||||
下载完成后修改文件名为 `minikube`,然后 `chmod +x minikube`,移动到 `$PATH` 目录下:
|
||||
|
||||
```bash
|
||||
mv ~/Download/minikube-darwin-adm64 /usr/loal/bin/
|
||||
chmod +x /usr/local/bin/minikube
|
||||
sudo mv ~/Download/minikube-darwin-adm64 /usr/loal/bin/
|
||||
sudo chmod +x /usr/local/bin/minikube
|
||||
```
|
||||
|
||||
## 安装 kubectl
|
||||
|
||||
**方式一**
|
||||
|
||||
参考 [Install and Set Up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/),直接使用二进制文件安装即可。
|
||||
|
||||
```bash
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
|
||||
或者:
|
||||
先访问https://storage.googleapis.com/kubernetes-release/release/stable.txt
|
||||
得到返回值,假设为:v1.9.1,然后拼接网址,直接在浏览器访问:
|
||||
https://storage.googleapis.com/kubernetes-release/release/v1.9.1/bin/darwin/amd64/kubectl
|
||||
直接下载kubectl文件。
|
||||
```
|
||||
|
||||
**方式二**
|
||||
|
||||
先访问 <https://storage.googleapis.com/kubernetes-release/release/stable.txt>
|
||||
得到返回值,假设为 `v1.18.4`,然后拼接网址,直接在浏览器访问:
|
||||
<https://storage.googleapis.com/kubernetes-release/release/v1.18.4/bin/darwin/amd64/kubectl> 直接下载 kubectl 文件。
|
||||
|
||||
若第一种方式访问多次超时,可以使用上述的第二种方式访问。
|
||||
|
||||
## 启动 Minikube
|
||||
|
||||
假设使用xhyve-driver虚拟技术,则需要在minikube start加入参数 `--vm-driver=xhyve`。
|
||||
执行 `minikube start` 即可自动下载依赖文件,开始安装和启动 minikube。该过程中将自动执行以下步骤:
|
||||
|
||||
1. 下载 `docker-machine-driver-hyperkit`(10.9 M)
|
||||
1. 下载虚拟机镜像(近 200M)
|
||||
1. 下载 Kubernetes 安装包(500 多 M)
|
||||
|
||||
安装完成后将生成默认的 `~/.kube/config` 文件,自动指向 minikube 集群。
|
||||
|
||||
注意:在安装过程中建议配置代理,否则将会有的镜像无法下载。
|
||||
|
||||
## 常用命令
|
||||
|
||||
下面是 minkube 的常用命令。
|
||||
|
||||
```bash
|
||||
minikube start --vm-driver=xhyve
|
||||
Starting local Kubernetes v1.7.5 cluster...
|
||||
Starting VM...
|
||||
Downloading Minikube ISO
|
||||
139.09 MB / 139.09 MB [============================================] 100.00% 0s
|
||||
Getting VM IP address...
|
||||
Moving files into cluster...
|
||||
Setting up certs...
|
||||
Connecting to cluster...
|
||||
Setting up kubeconfig...
|
||||
Starting cluster components...
|
||||
Kubectl is now configured to use the cluster.
|
||||
```
|
||||
# 进入集群节点
|
||||
minikube ssh
|
||||
|
||||
这将生成默认的`~/.kube/config`文件,自动指向minikube。
|
||||
# 查看节点 IP
|
||||
minikube ip
|
||||
|
||||
## 停止Minikube
|
||||
|
||||
```bash
|
||||
# 停止集群
|
||||
minikube stop
|
||||
|
||||
# 删除集群
|
||||
minikube delete
|
||||
```
|
||||
|
||||
## 参考
|
||||
|
||||
[Running Kubernetes Locally via Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/)
|
||||
|
||||
[Install minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
|
||||
[Driver plugin installation - xhyve-driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#xhyve-driver)
|
||||
- [Install minikube - kubernetes.io](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
|
|
Loading…
Reference in New Issue