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
相关推荐
troy12810 小时前
阿里云 vs 谷歌云:Kubernetes 部署深度对比分析
阿里云·kubernetes·云计算
谢亮_vipxieliang14 小时前
容器排障实战手册:从日志到内核的分层排障
docker·云原生·容器·eureka
wzq11_66617 小时前
Kubernetes集群——Pod篇
云原生·容器·kubernetes
wzq11_66618 小时前
Kubernetes集群——命令篇
云原生·容器·kubernetes
小白的码BUG之路19 小时前
Docker -- 构建ruoyi-gateway镜像
docker·容器·gateway
小白的码BUG之路19 小时前
Docker -- 构建ruoyi-system镜像
运维·docker·容器
LRL_19 小时前
【云原生】Oracle Linux 9.6 离线(Air-Gapped)环境下安装 Longhorn 及其底层依赖(iSCSI/NFS)完全指南
linux·云原生·oracle
小白的码BUG之路19 小时前
Docker -- 构建redis镜像
运维·docker·容器
江湖有缘20 小时前
Docker实战 | 使用Docker部署EspoCRM开源客户关系管理平台
docker·容器·开源
Henry-SAP20 小时前
SAP MMBE跨工厂库存层级展示解析
人工智能·云原生·sap·erp