1.配置hosts文件
vi /etc/hosts
本机ip 本机hostname 本机hostname
2.关闭防火墙, sawp等
systemctl stop firewalld
systemctl disable firewalld
3.关闭swap
4.禁用selinux
vi /etc/selinux/config
SELINUX=disabled
/usr/sbin/sestatus -v 查看selinux状态
5.安装docker
step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Step 3: 更新并安装Docker-CE
yum makecache --refresh
sudo yum -y install docker-ce
发现报错:Problem: package docker-ce-3:19.03.12-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
因为containerd 版本过低
dnf install container-selinux
通过yum -y install https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm 升级即可
Step 4: docker 修改Cgroup Driver以及docker镜像拉取地址
cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://e7l8pkuq.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
Step 5: 开启Docker服务
sudo service docker start
6.安装kubectl
step 1:下载最新kubectl最新资源
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
step 2:添加执行权限
chmod +x ./kubectl
step 3:移动kubectl至bin路径
sudo mv ./kubectl /usr/local/bin/kubectl
step 4:确认安装的版本
kubectl version --client
7.安装minikube
step 1:确认是否支持虚拟化
grep -E --color 'vmx|svm' /proc/cpuinfo
step 2:下载minikube资源
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& chmod +x minikube
step 3:添加minikube进入系统命令
sudo mkdir -p /usr/local/bin/
sudo install minikube /usr/local/bin/
step 4:启动 minikube(本文使用的VM安装的centos 8因此设置driver=none)
minikube start --driver=none --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers
step 5:确认minikube状态
minikube status