Kubeadm 搭建K8s集群
前置操作 (每台机器上都需要操作) 使用系统 Centos 7 cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) 关闭防火墙 systemctl stop firewalld && systemctl disable firewalld 禁用SELINUX vim /etc/selinux/config # 或者修改/etc/sysconfig/selinux SELINUX=disabled [注意] 开启 IP 路由转发和 NAT # https://ccie.lol/knowledge-base/linux-centos-route-forwarding/ # 不开启会导致 Pod 无法链接外网以及 Pod 间无法通信的问题. [root@host ~]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf [root@host ~]# sysctl -p [root@host ~]# sysctl -a | grep "ip_forward" net.ipv4.ip_forward = 1 # 开启NAT [root@host ~]# iptables -P FORWARD ACCEPT # 缺省允许 IP 转发 # 利用 iptables 实现 NAT MASQUERADE 共享上网,此处 eth0 需要是能够访问外部网络的网卡接口 [root@host ~]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 修改 k8s....