集群结构
角色 |
IP |
master |
192.168.35.135 |
node1 |
192.168.35.136 |
node2 |
192.168.35.137 |
部署
#需在三台主机上操作
//关闭防火墙
[root@master ~]# systemctl disable --now firewalld
//关闭selinux
[root@master ~]# sed -i 's/enforcing/disabled/' /etc/selinux/config
//关闭swap分区
[root@master ~]# vim /etc/fstab
注释掉swap分区就行
//设置主机名
[root@master ~]# hostnamectl set-hostname master.example.com
//添加host
[root@master ~]# cat >> /etc/hosts << EOF
192.168.35.135 master master.example.com
192.168.35.136 node1 node1.example.com
192.168.35.137 node2 node2.example.com
EOF
//将桥接的IPv4流量传递到iptables的链
[root@master ~]# cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
[root@master ~]# sysctl --system