1.服务器系统进行初始化操作
1.准备3台服务器,系统是centos7
关闭3台服务器防火墙
systemctl stop firewalld //临时关闭
systemctl disable firewalld //永久关闭
systemctl status firewalld //查看防火墙状态
关闭3台selinux
setenforce 0 //临时关闭
sed -i 's/enforcing/disabled/' /etc/selinux/config //永久关闭
reboot //重启系统
sestatus //查看selinux状态
关闭3台swap分区
swapoff -a //临时
sed -ri 's/.swap./#&/' /etc/fstab // 永久
根据规划设置3台主机名
hostnamectl set-hostname k8smarster //第一台设置主机名字为k8smarster
hostnamectl set-hostname k8snode1 //第二台设置主机名字为k8snode1
hostnamectl set-hostname k8snode2 //第三台设置主机名字为k8snode2
在master一台主机上添加hosts
cat >> /etc/hosts << EOF
192.168.178.171 k8s-master
192.168.178.172 k8s-node1
192.168.178.173 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