Flannel is a virtual network that gives a subnet to each host for use with container runtimes.
Platforms like Kubernetes assume that each container (pod) has a unique, routable IP inside the cluster. The advantage of this model is that it reduces the complexity of doing port mapping.
Flannel runs an agent, flanneld
, on each host and is responsible for allocating a subnet lease out of a preconfigured address space. Flannel uses either etcd or the Kubernetes API to store the network configuration, allocated subnets, and auxiliary data (such as host's IP). Packets are forwarded using one of several backend mechanisms.
The following diagram demonstrates the path a packet takes as it traverses the overlay network:
The easiest way to deploy flannel with Kubernetes is to use one of several deployment tools and distributions that network clusters with flannel by default. CoreOS's Tectonic sets up flannel in the Kubernetes clusters it creates using the open source Tectonic Installer to drive the setup process.
It's easy to use flannel with Kubernetes. Flannel can use the Kubernetes API as its backing store, meaning there's no need to deploy a discrete etcd
cluster for flannel
. This flannel
mode is known as the kube subnet manager and is demonstrated below.
Flannel can be added to any existing Kubernetes cluster. It's simplest to add flannel
before any pods using the pod network have been started.
For information on deploying flannel manually, using the (currently alpha) Kubernetes installer toolkit kubeadm, see Installing Kubernetes on Linux with kubeadm.
Once applied, the flannel
manifest defines three things:
- A service account for
flannel
to use. - A ConfigMap containing both a CNI configuration and a
flannel
configuration. The network in theflannel
configuration should match the pod network CIDR. The choice ofbackend
is also made here and defaults to VXLAN. - A DaemonSet to deploy the
flannel
pod on each Node. The pod has two containers 1) theflannel
daemon itself, and 2) a container for deploying the CNI configuration to a location that thekubelet
can read.
When you run pods, they will be allocated IP addresses from the pod network CIDR. No matter which node those pods end up on, they will be able to communicate with each other.
- Building (and releasing)
- Configuration
- Backends
- Running
- Troubleshooting
- Projects integrating with flannel
- Production users
- Mailing list: coreos-dev
- IRC: #coreos on freenode.org
- Planning/Roadmap: milestones, roadmap
- Bugs: issues
See CONTRIBUTING for details on submitting patches and the contribution workflow.
See reporting bugs for details about reporting any issues.
Flannel is under the Apache 2.0 license. See the LICENSE file for details.