1,在所有节点安装ipvs
yum install ipset ipvsadm

2,在所有节点运行
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
chmod 755 /etc/sysconfig/modules/ipvs.modules
bash /etc/sysconfig/modules/ipvs.modules
lsmod | grep ip_vs
每个节点执行完毕应该都可以看见已经加载的ipvs模块

3,开启ipvs
kubectl edit -n kube-system cm kube-proxy

k8s学习笔记之启用ipvs
将mode: " "修改为mode: "ipvs"

4,重新生成kube-poxy的pod
先查出各个kube-proxy的pod
k8s学习笔记之启用ipvs
删除所有kube-proxy打头的pod
系统会重新生成新的pod
kubectl get pods -n kube-system|grep kube-proxy|cut -d" " -f1|xargs -i -n 1 kubectl delete pod {} -n kube-system
k8s学习笔记之启用ipvs

5,查看:
ipvsadm -ln
k8s学习笔记之启用ipvs

kubectl describe -n kube-system cm kube-proxy
k8s学习笔记之启用ipvs

kubectl get deploy,pods -n kube-system -o wide
k8s学习笔记之启用ipvs

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐