k8s svc流量转发

https://blog.csdn.net/qq_44930876/article/details/134813129

https://blog.csdn.net/weixin_43845924/article/details/136232099

默认使用iptables

bash 复制代码
[root@localhost ~]# k logs kube-proxy-jcbcq  
I0405 10:37:28.610683       1 node.go:136] Successfully retrieved node IP: 192.168.150.81
I0405 10:37:28.610898       1 server_others.go:111] kube-proxy node IP is an IPv4 address (192.168.150.81), assume IPv4 operation
W0405 10:37:30.083245       1 server_others.go:579] Unknown proxy mode "", assuming iptables proxy
bash 复制代码
[root@localhost ~]# k get cm kube-proxy -o yaml| grep mode
    mode: ""

访问 10.1.173.212 的流量 转到 KUBE-SVC-GSTOWW43R3XNF3UU 处理

bash 复制代码
-A KUBE-SERVICES ! -s 10.244.0.0/16 -d 10.1.173.212/32 -p tcp -m comment --comment "default/helloworld:grpc cluster IP" -m tcp --dport 80 -j KUBE-MARK-MASQ
-A KUBE-SERVICES -d 10.1.173.212/32 -p tcp -m comment --comment "default/helloworld:grpc cluster IP" -m tcp --dport 80 -j KUBE-SVC-GSTOWW43R3XNF3UU

KUBE-SVC-GSTOWW43R3XNF3UU 负载均衡

bash 复制代码
-A KUBE-SVC-GSTOWW43R3XNF3UU -m comment --comment "default/helloworld:grpc" -m statistic --mode random --probability 0.33333333349 -j KUBE-SEP-TXM7ZWVLBOV6HOOE
-A KUBE-SVC-GSTOWW43R3XNF3UU -m comment --comment "default/helloworld:grpc" -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-DWGWB6DOLSQRMVMH
-A KUBE-SVC-GSTOWW43R3XNF3UU -m comment --comment "default/helloworld:grpc" -j KUBE-SEP-SS4FDJNRUP7KZYAK
bash 复制代码
[root@localhost ~]# iptables-save| grep helloworld | grep "A KUBE-SEP" | grep default/helloworld:grpc | grep tcp
-A KUBE-SEP-DWGWB6DOLSQRMVMH -p tcp -m comment --comment "default/helloworld:grpc" -m tcp -j DNAT --to-destination 10.244.0.28:80
-A KUBE-SEP-SS4FDJNRUP7KZYAK -p tcp -m comment --comment "default/helloworld:grpc" -m tcp -j DNAT --to-destination 10.244.0.29:80
-A KUBE-SEP-TXM7ZWVLBOV6HOOE -p tcp -m comment --comment "default/helloworld:grpc" -m tcp -j DNAT --to-destination 10.244.0.24:80
相关推荐
妍妍的宝贝1 小时前
k8s 中的金丝雀发布(灰度发布)
云原生·容器·kubernetes
梆子井欢喜坨2 小时前
《Cloud Native Data Center Networking》(云原生数据中心网络设计)读书笔记 -- 12数据中心中的EVPN
网络·云原生
iangyu3 小时前
docker常用命令
运维·docker·容器
Dylanioucn3 小时前
【分布式微服务云原生】掌握 Redis Cluster架构解析、动态扩展原理以及哈希槽分片算法
算法·云原生·架构
飞酱不会电脑6 小时前
云计算第四阶段 CLOUD2周目 01-03
云原生·容器·kubernetes
程序那点事儿7 小时前
k8s 之安装busybox
云原生·容器·kubernetes
weixin_453965008 小时前
master节点k8s部署]33.ceph分布式存储(四)
分布式·ceph·kubernetes
是芽芽哩!8 小时前
【Kubernetes】常见面试题汇总(五十八)
云原生·容器·kubernetes
福大大架构师每日一题19 小时前
22.1 k8s不同role级别的服务发现
容器·kubernetes·服务发现
莹雨潇潇19 小时前
Docker 快速入门(Ubuntu版)
java·前端·docker·容器