四个POD流量分流,iptables 规则如下

-A KUBE-SVC-W6WAXM5BH6NL6XVI -m comment --comment "default/stilton:http" -m statistic --mode random --probability 0.25000000000 -j KUBE-SEP-CNYVGC2BVT2LZTTQ
-A KUBE-SVC-W6WAXM5BH6NL6XVI -m comment --comment "default/stilton:http" -m statistic --mode random --probability 0.33332999982 -j KUBE-SEP-JIUL6WA4RDBFQM3A
-A KUBE-SVC-W6WAXM5BH6NL6XVI -m comment --comment "default/stilton:http" -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-N7FRCVWSMEQSSPP6
-A KUBE-SVC-W6WAXM5BH6NL6XVI -m comment --comment "default/stilton:http" -j KUBE-SEP-4IO5BXFRFMJKHYHX

分析:

一共4个容器,第一个容器分到了1/4的流量。
第二个容器,因为剩余3/4,所以乘以1/3,所以也是1/4的流量。
第三个容器是,1/2乘以1/2,也会得到1/4的流量。
第四个容器,获取剩余的1/4。

 

模拟丢包环境:

# for randomly dropping 10% of incoming packets:
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP

 

参考链接:

https://www.ipcpu.com/2018/03/kubernetes-service/

 

相关文章:

  • 2021-10-14
  • 2021-06-25
  • 2022-01-21
  • 2021-11-15
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2021-05-26
  • 2021-08-18
  • 2021-07-04
  • 2021-06-03
相关资源
相似解决方案