hostnamectl set-hostname master1
hostnamectl set-hostname node1
hostnamectl set-hostname node2
vim /etc/sysconfig/network- scripts/ifcfg-ens33
systemctl restart network
ip a s
vim /etc/hosts
cat /etc/hosts
systemctl stop firewalld
systemctl disable firewalld
firewall-cmd --state
[root@XXX ~]# sed -ri ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
yum -y install ntpdate crontab -l 0 */1 * * * ntpdate time1.aliyun.com
date
vim /etc/fstab #在swap文件系统对应的行,行首添加#表示注释。
cat /etc/fstab
添加网桥过滤及地址转发 [root@XXX ~]# cat /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 vm.swappiness = 0 加载br_netfilter模块 [root@XXX ~]# modprobe br_netfilter 查看是否加载 [root@XXX ~]# lsmod | grep br_netfilter br_netfilter 22256 0 bridge 151336 1 br_netfilter 加载网桥过滤配置文件 [root@XXX ~]# sysctl -p /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 vm.swappiness = 0
yum -y install ipset ipvsadm
cat > /etc/sysconfig/modules/ipvs.modules <<EOF
#!/bin/bash
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack_ipv4
EOF
授权、运行、检查是否加载
[root@XXX ~]# chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack_ipv4
检查是否加载 [root@XXX ~]# lsmod | grep -e ipvs -e nf_conntrack_ipv4
原文:https://www.cnblogs.com/zcl1116/p/14952141.html