1.1、关闭防火墙

  1. systemctl stop firewalld # 临时
  2. systemctl disable firewalld # 永久

1.2、关闭 selinux

  1. sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久
  2. setenforce 0 # 临时

1.3、关闭 swap

  1. swapoff -a # 临时
  2. vim /etc/fstab # 永久

1.4、设置主机名

  1. hostnamectl set-hostname <hostname>

1.5、添加hosts

  1. cat >> /etc/hosts << EOF
  2. 192.168.31.61 k8s-master
  3. 192.168.31.62 k8s-node1
  4. 192.168.31.63 k8s-node2
  5. EOF

1.6、将桥接的 IPv4 流量传递到 iptables 的链

  1. cat > /etc/sysctl.d/k8s.conf << EOF
  2. net.bridge.bridge-nf-call-ip6tables = 1
  3. net.bridge.bridge-nf-call-iptables = 1
  4. EOF

使生效:

  1. sysctl --system # 生效

1.7、时间同步

  1. yum install ntpdate -y
  2. ntpdate time.windows.com