lamesbond

ipvs 模式的 k8s 本地端口不通

  •  
  •   lamesbond · Dec 31, 2021 · 2697 views
    This topic created in 1619 days ago, the information mentioned may be changed or developed.

    deployment 里有 2 个 pod ,通过 nodeport 类型的 service 暴露出去,pod 端口,service 端口,nodeport 端口都是 8086 。

    kube-proxy 使用 ipvs 模式,telnet 127.0.0.1 8086 不通,换成本机 eth0 核 podip 都能通,尝试删除 ipvs 127.0.0.1:8086 那条规则后 telnet 127.0.0.1 8086 通了,为什么?

    https://s3.bmp.ovh/imgs/2021/12/5dd01097bdca06aa.png

    2 replies    2022-01-06 14:03:18 +08:00
    FabricPath
        2
    FabricPath  
       Jan 6, 2022
    信息太少,和你的路由表、iptables 都有关,贴出
    ip route
    iptables-save
    ipvsadm-save
    ip rule (如果有策略路由还需要 ip route show table xxxx 给每个 table)

    看你截图,估计是只做了 DNAT (这是正常的)但是没有做 SNAT ,到 Pod 里面去之后,Pod 回包回不回来,到 Pod 里面去 tcpdump -vv -n -i any tcp port 8086 看看不同情况下源 IP 的差异
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1480 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 16:32 · PVG 00:32 · LAX 09:32 · JFK 12:32
    ♥ Do have faith in what you're doing.