kubernetes v1.18.3 切换IPVS

为什么切换IPVS呢,两点原因:第一是IPVS性能好(PS:就几千台Pod没感觉到),第二是因为iptables每次重启完就要处理下FORWARD链的问题,烦得很

1、检查内核是否支持ipvs

# lsmod|grep ip_vs

2、如果没有就加载

modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack_ipv4

3、安装ipvs

# yum install ipvsadm ipset -y

4、修改kube-proxy配置

# kubectl edit configmap kube-proxy -n kube-system

metricsBindAddress: “”
mode: “”
nodePortAddresses: null

改为

metricsBindAddress: “”
mode: “ipvs”
nodePortAddresses: null

5、删除kube-proxy

到了最蛋疼的时候了,按理说编辑了配置文件应该立即生效的,但是怎么查看都还是原来的配置,最后不得已删除了pod

IPVS不生效

# kubectl delete pod kube-proxy-sjgjc -n kube-system

新的kube-proxy起来了

# kubectl logs kube-proxy-zdvgm -n kube-system

IPVS起来了

自此,再也不用折腾这个破FORWARD链了

6 评论

  1. Hello there I am so delighted I found your weblog,
    I really found you by accident, while I was looking on Yahoo for something else, Anyhow I am here now and would
    just like to say thanks a lot for a remarkable post and a
    all round thrilling blog (I also love the theme/design), I
    don’t have time to look over it all at the moment but I have bookmarked it and also added in your RSS feeds,
    so when I have time I will be back to read a great deal more, Please
    do keep up the great b.

  2. Does your website have a contact page? I’m having problems locating it but, I’d like to shoot you an e-mail.
    I’ve got some ideas for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it expand over time.

  3. Hello there, I think your site may be having browser compatibility problems.

    Whenever I look at your web site in Safari, it looks
    fine however, if opening in Internet Explorer, it has some overlapping issues.
    I just wanted to provide you with a quick heads up!
    Aside from that, fantastic blog!

留下评论

error: Content is protected !!