1.关闭SElinux

setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config

2.需要设置桥接路由

yum install -y bridge-utils.x86_64
modprobe  br_netfilter  # 加载br_netfilter模块,使用lsmod查看开启的模块
cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system  # 重新加载所有配置文件

3.关闭防火墙

systemctl stop firewalld 
systemctl disable --now firewalld 

4.k8s要求关闭swap

swapoff -a && sysctl -w vm.swappiness=0  # 关闭swap
sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab  # 取消开机挂载swap

5.更改/etc/hosts文件

#添加各主机的主机名解析,例如:
192.168.1.100 master
192.168.1.101 node1
192.168.1.102 node2

water_liu
7 声望0 粉丝

公主号:运维大师兄