【笔记】大规模Kubernetes集群的Service性能优化
一、Ref二、k8s的Service与Endpoint三、iptables实现Service负载均衡3.1 iptables介绍3.2 iptables实现流量转发与负载均衡3.3 iptables在kubernetes中的应用举例四、当前iptables实现存在的问题一、Ref【1】华为云在 K8S 大规模场景下的 Service 性能优化实践【2】PPT...
·
一、Ref
【1】华为云在 K8S 大规模场景下的 Service 性能优化实践
【2】PPT:https://download.csdn.net/download/hello2mao/10434103
二、k8s的Service与Endpoint
- Endpoint Controller会watch Service以及pod的变化,维护对应的Endpoint信息。
- kube-proxy根据Service和Endpoint来维护本地的路由规则。当Endpoint发生变化,即Service以及关联的pod发生变化,kube-proxy都会在每个节点上更新iptables,实现一层负载均衡。
三、iptables实现Service负载均衡
3.1 iptables介绍
3.2 iptables实现流量转发与负载均衡
(1)流量转发–DNAT 实现IP地址和端口映射
iptables -t nat -A PREROUTING -d 1.2.3.4/32 --dport 80 -j DNAT --to-destination 10.20.30.40:8080
(2)负载均衡–statistic 模块为每个后端设置权重
iptables -t nat -A PREROUTING -d 1.2.3.4 --dport 80 -m statistic --mode random --probability .25 -j DNAT --to-destination 10.20.30.40:8080
(3)回话保持–recent 模块设置会话保持时间
iptables -t nat –A FOO -m recent --rcheck --seconds 3600 --reap --name BAR -j BAR
3.3 iptables在kubernetes中的应用举例
TODO
四、当前iptables实现存在的问题
TODO
更多推荐
已为社区贡献4条内容
所有评论(0)