当前位置:网站首页>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特点:
边栏推荐
- Flutter textfield sets the height and automatically wraps lines, and the rounded border removes the underline
- Use grid to realize left, middle and right layout, and the middle content is adaptive
- LCD笔记(6)LCD驱动程序框架_配置引脚
- Food safety | these common foods are poisonous! Check your dining table quickly
- Redisson distributed lock usage example (I)
- 虚拟偶像代言产品出问题谁负责?且听律师分析
- mqtt send receive
- Where is safe to open an account when buying stocks on mobile phones?
- The programmed navigation route jumps to the current route (the parameters remain unchanged), and if it is executed multiple times, it will throw a navigationduplicated warning error?
- How to optimize a large number of if else [email protected] Detailed explanation of valib
猜你喜欢

【TypeScript】TypeScript常用类型(上篇)

历史上的今天:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone...

可移动表空间

Huawei recruited "talented teenagers" twice this year; 5.4 million twitter account information was leaked, with a selling price of $30000; Google fired engineers who believed in AI consciousness | gee

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

RMII, smii, gmii, rgmii interfaces of Ethernet Driver

一款超好用的神器Apifox,甩 Swagger 几条街...(荣耀典藏版)

食品安全 | 无菌蛋真的完全无菌吗?

Emerging security providers to learn about in 2022

Visual stdio(VS)中的(int argc、char** argv)命令行参数
随机推荐
Knowledge points of C language documents
yolov7训练危险品识别 pytorch
Tencent cloud and smart industry business group (CSIG) adjusted the organizational structure and established the digital twin product department
The difference between $route and $route
Shell variables and references
Backtracking - 46. Full arrangement
今日睡眠质量记录75分
LCD notes (6) LCD driver framework_ Configuration pin
SLAM 02.整体框架
Notes....
Kubernetes----安装部署NFS服务器
数据库组成表
代码报错解决问题经验之二:YOLOv5中的test报错
Food safety | are sterile eggs really completely sterile?
Visual stdio(VS)中的(int argc、char** argv)命令行参数
Guys, how can CDC Oracle set the reading from the specified SCN number, or how to set the read-only full archive, not to read fast
The.Net webapi uses groupname to group controllers to render the swagger UI
Microsoft has shut down two attack methods: Office macro and RDP brute force cracking
Yolov7 training dangerous goods identification pytorch
Use float to realize left, middle and right layout, and the middle content is adaptive