1.关闭防火墙:
2.关闭selinux:
3.关闭swap:
4.设置主机名:
5.添加hosts映射
6.将桥接的IPv4流量传递到iptables的链:
7.时间同步:
'''
关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
关闭selinux:
sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久
setenforce 0 # 临时
关闭swap:
swapoff -a # 临时
sed -i 's/.swap./#&/' /etc/fstab # 永久
设置主机名:
hostnamectl set-hostname <hostname>
在master添加hosts:
cat >> /etc/hosts << EOF
192.168.31.61 k8s-master
192.168.31.62 k8s-node1
192.168.31.63 k8s-node2
EOF
将桥接的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 # 生效
时间同步:
yum install ntpdate -y
ntpdate time.windows.com
'''