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
相关推荐
小夏子_riotous5 小时前
Docker学习路径——3、常用命令
linux·运维·服务器·学习·docker·容器·centos
没有口袋啦7 小时前
《基于 GitOps 理念的企业级自动化 CI/CD 流水线》
阿里云·ci/cd·云原生·自动化·k8s
HYNuyoah9 小时前
docker 安装win10系统
运维·docker·容器
柯西劝我别收敛9 小时前
Koordinator-Scheduler 调度器源码解析
后端·云原生
WAIT_TIME15 小时前
昇腾910B虚拟卡(vNPU)创建以及Docker挂载
docker·容器·昇腾·runtime·虚拟显卡·vnpu
tian_jiangnan16 小时前
把 Docker 镜像推送到 阿里云容器镜像服务 ACR
阿里云·docker·容器
行者-全栈开发18 小时前
拆解高可用CRM网站的容灾设计与云原生实践
微服务·云原生·异地多活·监控告警·高可用设计·crm架构·容灾演练
Crazy________19 小时前
4.13docker仓库registry
mysql·算法·云原生·eureka
Eric.Lee20211 天前
docker 启动停止命令
运维·docker·容器
小义_1 天前
【Kubernetes】(五) pod2
linux·云原生·容器·kubernetes