准备工作
需要配置三台虚拟机
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
临时关闭selinux
setenforce 0
永久关闭selinux
vi /etc/selinux/config
安装docker
rpm -qa|grep docker
yum remove docker* -y
rpm -qa|grep docker
yum install -y yum-utils
#配置docker的yum地址
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#安装指定版本
yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io-1.4.6
启动&开机启动docker
systemctl start docker
systemctl enable docker --now
docker加速配置
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
systemctl daemon-reload
systemctl restart docker
安装Kubernetes
基本环境
每个机器使用内网ip互通
#分别设置每个机器自己的hostname
hostnamectl set-hostname master