准备工作 每台机子都执行
关闭selinux
if [[ $(getenforce) -eq 'Enforcing' ]]
then setenforce 0;sed -i 's/=enforcing/=disabled/' /etc/selinux/config;fi
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭swap
swapoff -a
sed -i '/swap/s/^/#/' /etc/fstab
添加环境变量
echo "export PATH=/opt/kubernetes/bin/:$PATH" >> /etc/profile
source /etc/profile
设置主机名
这里方便识别 node 后面加的是IP的后两位
这里测试的ip 10.0.81.74
hostnamectl set-hostname master-81-74 --static
将桥接的IPv4流量传递到iptables的链
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
重启
reboot