以下是在CentOS上配置Kubernetes网络的指南:
/etc/sysconfig/network-scripts/ifcfg-<interface>文件,设置BOOTPROTO=static,并指定IPADDR、NETMASK、GATEWAY和DNS等参数,然后重启网络服务systemctl restart network。systemctl stop firewalld,systemctl disable firewalld,setenforce 0,并编辑/etc/selinux/config将SELINUX设为disabled。hostnamectl set -hostname <hostname>设置主机名,在/etc/hosts中添加集群节点IP和主机名。kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml。kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml。kubectl get nodes查看节点状态,kubectl get pods -n kube -system查看Pod状态,还可通过ping命令测试网络连通性。