Last updated on

Flannel


Flannel runs a small, single binary agent called flanneld on each host, and is responsible for allocating a subnet lease to each host out of a larger, preconfigured address space. Flannel uses either the Kubernetes API or etcd directly to store the network configuration, the allocated subnets, and any auxiliary data (such as the host’s public IP). Packets are forwarded using one of several backend mechanisms including VXLAN and various cloud integrations.
Flannel在每个主机上运行一个名为flanneld的小型单二进制代理,并负责从较大的预配置地址空间中向每个主机分配子网租约。Flannel直接使用Kubernetes API或etcd来存储网络配置,分配的子网以及任何辅助数据 (例如主机的公共IP)。使用包括VXLAN和各种云集成在内的几种后端机制之一转发数据包。

Networking details

Platforms like Kubernetes assume that each container (pod) has a unique, routable IP inside the cluster. The advantage of this model is that it removes the port mapping complexities that come from sharing a single host IP.
像Kubernetes这样的平台假设每个容器 (pod) 在集群内部都有一个唯一的、可路由的IP。此模型的优点是它消除了共享单个主机IP带来的端口映射复杂性。

Flannel is responsible for providing a layer 3 IPv4 network between multiple nodes in a cluster. Flannel does not control how containers are networked to the host, only how the traffic is transported between hosts. However, flannel does provide a CNI plugin for Kubernetes and a guidance on integrating with Docker.
Flannel负责在集群中的多个节点之间提供第3层IPv4网络。Flannel不控制容器如何与主机联网,仅控制流量如何在主机之间传输。但是,flannel确实为Kubernetes提供了CNI插件,并提供了与Docker集成的指南。

Flannel is focused on networking. For network policy, other projects such as Calico can be used.
Flannel专注于网络。对于网络策略,可以使用其他项目,例如Calico。

Ref

📄 Technical Analysis of Network Plug⁃in Flannel for Containers.pdf (2334 KB)(暂未托管,后续换成 Google Drive 分享链接)

📄 Flannel.pdf (4028 KB)(暂未托管,后续换成 Google Drive 分享链接)