Docs/CloudNative/Kubernetes/Base/MiniKube安装配置.md
2022-10-18 16:59:37 +08:00

74 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 安装docker-ce
## 安装必要的系统工具软件
`yum install -y yum-utils device-mapper-persistent-data lvm2`
## 添加软件源
```
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
```
## 更新源并安装docker
```
yum makecache fast
yum -y install docker-ce
```
## 配置docker加速
### 修改/etc/docker/daemon.json文件添加阿里云镜像加速
***需要创建/etc/docker目录与daemon.json文件***
```
{
"registry-mirrors": ["https://yn64512p.mirror.aliyuncs.com"]
}
```
### 启动docker
```
systemctl daemon-reload
systemctl restart docker
```
# 安装MiNiKube
## 添加用户
```
useradd -u 530 -g docker k8s
```
## 下载kubectl,并移动到/home/k8s/.bin目录中k8s用户可直接执行并添加到PATH中
```
su - k8s
mkdir .bin
cd .bin && curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x kubectl
cat ~/.bash_profile
...
PATH=$PATH:~/.bin
export PATH
...
source ~/.bash_profile
```
## 下载安装MiniKube
```
cd /home/k8s/.bin
wget https://github.com/kubernetes/minikube/releases/download/v1.15.0/minikube-linux-x86_64
```
## 启动MiniKube
```
minikube start --network-plugin=cni --cni=calico
```
# 暂停集群
```
minikubu pause
```
# 停止集群
```
minikube stop
```
# 卸载集群
```
minikube delete --all
```