Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
kidlj
V2EX  ›  云计算

kube-proxy IPVS 模式的一个疑问

  •  
  •   kidlj · Nov 21, 2018 · 2567 views
    This topic created in 2757 days ago, the information mentioned may be changed or developed.

    经过仔细研究发现,kube-proxy 开启了 IPVS 模式的情况下:

    1. 访问 service 的入流量,iptables 只是 mark 封包就完成了,后面交给了 IPVS 来做 DNAT。

    2. 由 endpoint 到 service 的出流量,iptables mark 封包以后又做了 MASQUERADE 的工作;这一步的工作为什么不能交由 IPVS 直接完成?

    Chain KUBE-POSTROUTING (1 references)
    target     prot opt source               destination
    MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0            /* kubernetes service traffic requiring SNAT */ mark match 0x4000/0x4000
    MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0            match-set KUBE-LOOP-BACK dst,dst,src
    

    另外请问,IPVS 模式的代理性能是否要比 iptables 好很多,是否还有必要自研四层负载均衡( Ingress Controller )呢?

    2 replies    2018-11-22 12:43:40 +08:00
    abmin521
        1
    abmin521  
       Nov 22, 2018 via Android
    第一个应该是 负载均衡用的

    第二个 随意啦
    kidlj
        2
    kidlj  
    OP
       Nov 22, 2018
    在 Kubernetes mailinglist 上发问,得到了下面的回复,感觉理解了。

    > It is not iptables doing *NAT/MASQUERADE, it is netfilter.
    iptables is just an interface to netfilter just like ipvs. So fall
    back here means ipvs does not setup *NAT rules for netfilter, it just
    call iptables to setup the rules.

    另外参考了华为做的 IPVS 和 iptables mode 的性能基准测试,IPVS 模式的性能会好很多,因为免除了大量 iptables rules 的增减,只使用了固定几条 iptables 规则。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   933 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:37 · PVG 04:37 · LAX 13:37 · JFK 16:37
    ♥ Do have faith in what you're doing.