当前位置:网站首页>Kubernetes Flannel:HOST-GW模式
Kubernetes Flannel:HOST-GW模式
2022-07-26 12:48:00 【富士康质检员张全蛋】

没有隧道这一说了,它们之间就是通过原始的数据包进行封装的。
当你设置flannel使用host-gw模式,flanneld会在宿主机上创建节点的路由表:
在上述的VXLAN的示例中,Node1和Node2其实是同一宿主机中的两台使用桥接模式的虚机,也就是说它们在一个二层网络中。在二层网络互通的情况下,直接配置节点的三层路由即可互通,不需要使用VXLAN隧道。要使用host-gw模式,需要修改 ConfigMap kube-flannel-cfg ,将 Backend.Type 从vxlan改为host-gw,然后重启所有kube-flannel Pod即可:
...net-conf.json: |{"Network": "10.244.0.0/16","Backend": {"Type": "host-gw" // <- 改成host-gw}}...
host-gw模式下的通信过程如下图所示:

在host-gw模式下,由于不涉及VXLAN的封包解包,不再需要flannel.1虚机网卡。flanneld 负责为各节点设置路由 ,将对应节点Pod子网的下一跳地址指向对应的节点的IP,如图中路由表①所示。[[email protected] ~]# ip r
...10.244.0.0/24 dev cni0 proto kernel scope link src 10.244.0.110.244.1.0/24 via 192.168.50.3 dev eth0 # Node2子网的下一跳地址指向Node2的public ip。...
由于没有封包解包带来的消耗,host-gw是性能最好的。不过一般在云环境下,都不支持使用host-gw的模式,在私有化部署的场景下,可以考虑。
----------------------------------------------------------------------------------------------------------------------------
HOST-GW模式
与UDP模式和VXLAN模式不同,HOST-GW模式属于路由的方式,无需经过任何封包和解包,纯路由机制实现,因此性能比较高。但是HOST-GW模式只支持宿主机之间二层连接,要求集群中所以节点必须处于同一个网络中。如果不在一个网络中,三层设备路由器缺少Pod 网络的路由规则,无法转发数据包。
HOST-GW模式将目的主机当作网关,直接路由原始的数据包。flanneld会在集群节点上创建并维护路由表,当数据包到达集群节点的时,就会根据路由表直接发送到下一跳,也就是同网段的节点IP,直接通过二层网络将数据转发到目的节点上;目的节点再根据路由表规则转发到cni网桥,网桥根据路由规则转发到容器里面。
HOST-GW模式通过路由转发实现高性能网络通信,但是这种模式局限性很大,节点之间都要相互有点对点的路由覆盖,每个节点上有n-1个路由,而n个节点共有n(n-1)/2个路由,才能保证flannel的flat网络能力。
K8s网络组件之Flannel:小结
VXLAN特点:
边栏推荐
- Paper reading MLPD: multi label pedestrian detector in multispectral domain (Internship Program of Hikvision Research Institute)
- JDBC gets connections from the connection pool (Druid connection pool)
- Qualcomm once again "bet" on Zhongke Chuangda to challenge the full stack solution of intelligent driving software and hardware
- JDBC从连接池获取连接(Druid连接池)
- Use positioning to realize left, middle and right layout, and the middle content is adaptive
- The best engineer was "forced" away by you like this!
- 0 basic programming resources (collect first ~ read slowly ~)
- 如何以文本形式查看加密过的信息
- 数字化时代,是什么“黄金宝藏”在推动百年药企发展?
- A super easy-to-use artifact apifox, throw swagger a few streets... (glory Collection Edition)
猜你喜欢

Version of NDK matched the requested version 21.0.6113669. versions available locally: 2

食品安全 | 这些常见食物小心有毒!速查自家餐桌

Kubernetes - Introduction to PV and PVC of advanced storage

Paper reading MLPD: multi label pedestrian detector in multispectral domain (Internship Program of Hikvision Research Institute)

若有声明”int x=5,y=1;”,则表达式x<y?x++:y++的结果是:

基于C#开放式TCP通信建立与西门子PLC的socket通信示例

维度灾难 维数灾难 暂记

Today in history: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone

Notes....

The best engineer was "forced" away by you like this!
随机推荐
Food safety | are sterile eggs really completely sterile?
JDBC从连接池获取连接(Druid连接池)
Redisson distributed lock usage example (I)
火山引擎云上增长方案全景:30+方案齐出,兵发优势领域
Version of NDK matched the requested version 21.0.6113669. versions available locally: 2
Today in history: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone
Router. Push(), router. Reply(), router. Go()
如何组装一个注册中心?
Where is safe to open an account when buying stocks on mobile phones?
Shutter background graying effect, how transparency, gray mask
Flutter prevents scientific counting and removes mantissa invalid 0
食品安全 | 随便果可以”随便“吃吗?
Backtracking - 46. Full arrangement
Shutter cachednetworkimage fillet
Flutter dart generates a list of random numbers that are not repeated in n intervals
Kubernetes----Kubernetes常用插件简介
Azure synapse analytics Performance Optimization Guide (2) -- optimize performance using materialized views (Part 1)
高通再次「押宝」中科创达,挑战智能驾驶软硬件全栈方案
Kubernetes -- Introduction to common plug-ins of kubernetes
Create EOS account action