所有节点执行下面命令

    1. # 关闭防火墙
    2. systemctl stop firewalld # 临时
    3. systemctl disable firewalld # 永久
    4. # 关闭selinux
    5. setenforce # 临时
    6. sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久
    7. # 关闭swap
    8. swapoff -a # 临时
    9. sed -i 's/.*swap.*/#&/' /etc/fstab # 永久
    10. # 根据规划设置主机名
    11. hostnamectl set-hostname <hostname>
    12. # 添加hosts
    13. cat >> /etc/hosts << EOF
    14. 192.168.1.180 master.k8s.io k8s-vip
    15. 192.168.1.63 master01.k8s.io master1
    16. 192.168.1.62 master02.k8s.io master2
    17. 192.168.1.61 node01.k8s.io node1
    18. EOF
    19. # 将桥接的IPv4流量传递到iptables的链
    20. cat >> /etc/sysctl.d/k8s.conf << EOF
    21. net.bridge.bridge-nf-call-ip6tables = 1
    22. net.bridge.bridge-nf-call-iptables = 1
    23. EOF
    24. sysctl --system # 生效
    25. # 时间同步
    26. yum install ntpdate -y
    27. ntpdate time.windows.com