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
相关推荐
分布式存储与RustFS1 分钟前
镜像仓库的层别只堆本地盘:用 RustFS 给 Harbor 当 S3 后端
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
分布式存储与RustFS2 小时前
工作流脚本和依赖 JAR 散在各节点本地盘:用 DolphinScheduler 资源中心接到 RustFS
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
Eyfcom3 小时前
〖物流云原生实战 01〗K8s Operator 在物流定时任务中的实践:从“裸 CronJob”到“声明式任务编排”
云原生·物流管理系统·物流云原生实战
阿里云云原生16 小时前
阿里云智能体白皮书开源进展
云原生
阿里云云原生17 小时前
万联智策基于 AgentCore 构建数字员工团队,800+智能体规模化落地
云原生
分布式存储与RustFS19 小时前
群晖 NAS 被 C3RB3R 锁了:本地备份一起被加密,RustFS 对象锁为什么删不掉
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
东风微鸣19 小时前
把 DeepSeek Harness 装进 K8s
kubernetes·deepseek·harness
江华森1 天前
4 台华为云 ECS 从零到一:我用 AI Agent 搭了一套 K3s 多节点集群,全自动、免运维、翻车实录
云原生
时间售卖铺1 天前
Chrony与SSH实战:精准时间同步与安全远程登录
运维·安全·云原生·ssh
分布式存储与RustFS1 天前
OpenObserve 的日志别堆本地盘:用 RustFS 当它的对象存储底座
运维·云原生·开源·对象存储·分布式存储·s3·性能基准