初始化
sudo iptables -F
sudo systemctl status firewalld
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl status firewalld

sudo setenforce 0
sudo sed -i ‘s/enforcing/disabled/’ /etc/selinux/config

sudo swapoff -a
sudo sed -ri ‘s/.swap./#$/g’ /etc/fstab

sudo sysctl --system
sudo yum -y install vim wget ntp telnet
sudo mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.bak
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum -y install vim wget ntp telnet
sudo yum clean all
sudo yum makecache
sudo yum -y update
sudo wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
sudo yum install docker-ce-20.10.0-3.el7 docker-ce-cli-20.10.0-3.el7 -y
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker
docker守护进程启动的时候,会默认赋予名字为docker的用户组读写Unix socket的权限,因此要创建docker用户组
sudo groupadd docker #添加docker用户组
sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中
newgrp docker #更新用户组
docker images #测试docker命令是否可以使用sudo正常使用

可选####修改docker驱动内核与k8s保持一致
sudo vim /etc/docker/daemon.json
{
“exec-opts”: [“native.cgroupdriver=systemd”]
}

sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl status docker
docker20.10适配k8s1.23适配rancher2.6.10

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐