Convert Figma logo to code with AI

flannel-io logoflannel

flannel is a network fabric for containers, designed for Kubernetes

9,168
2,886
9,168
29

Top Related Projects

115,996

Production-Grade Container Scheduling and Management

5,800

Container Network Interface - networking for Linux containers

6,557

Cloud native networking and network security

22,159

eBPF-based Networking, Security, and Observability

6,626

Simple, resilient multi-host containers networking and more.

9,167

flannel is a network fabric for containers, designed for Kubernetes

Quick Overview

Flannel is a simple and easy-to-use network fabric for Kubernetes. It creates a flat network overlay on top of existing network infrastructure, allowing pods to communicate with each other across different nodes in a Kubernetes cluster. Flannel is designed to be lightweight and efficient, making it a popular choice for container networking.

Pros

  • Easy to set up and configure
  • Supports multiple backend types (e.g., VXLAN, host-gw, UDP)
  • Works well with various cloud providers and on-premises environments
  • Actively maintained and widely adopted in the Kubernetes community

Cons

  • Limited advanced networking features compared to some alternatives
  • May have performance overhead in certain scenarios
  • Not suitable for complex network policies or multi-cluster setups
  • Lacks built-in network security features

Getting Started

To deploy Flannel in your Kubernetes cluster, follow these steps:

  1. Apply the Flannel manifest:
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
  1. Verify that Flannel pods are running:
kubectl get pods -n kube-system | grep flannel
  1. (Optional) Configure Flannel backend type in the ConfigMap:
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
data:
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }

Replace "vxlan" with your desired backend type (e.g., "host-gw" or "udp").

Competitor Comparisons

115,996

Production-Grade Container Scheduling and Management

Pros of Kubernetes

  • Comprehensive container orchestration platform with extensive features
  • Large, active community and ecosystem with robust support
  • Highly scalable and suitable for complex, enterprise-level deployments

Cons of Kubernetes

  • Steeper learning curve and more complex setup compared to Flannel
  • Requires more resources and overhead for smaller deployments
  • Can be overkill for simple networking needs in container environments

Code Comparison

Kubernetes (ConfigMap example):

apiVersion: v1
kind: ConfigMap
metadata:
  name: network-config
data:
  network-type: overlay

Flannel (Configuration example):

{
  "Network": "10.0.0.0/8",
  "Backend": {
    "Type": "vxlan"
  }
}

Summary

Kubernetes is a comprehensive container orchestration platform, while Flannel is focused on providing simple and efficient networking for container environments. Kubernetes offers a wide range of features and scalability but comes with increased complexity. Flannel, on the other hand, provides a more straightforward solution for container networking but lacks the extensive orchestration capabilities of Kubernetes.

The choice between the two depends on the specific needs of the project. For complex, large-scale deployments requiring advanced orchestration, Kubernetes is the better choice. For simpler setups primarily focused on container networking, Flannel may be more suitable.

5,800

Container Network Interface - networking for Linux containers

Pros of CNI

  • More flexible and extensible, supporting various network plugins
  • Standardized interface for container networking across different runtimes
  • Broader ecosystem support and community-driven development

Cons of CNI

  • Requires more configuration and setup compared to Flannel's simplicity
  • May have a steeper learning curve for beginners
  • Potentially more complex troubleshooting due to diverse plugin options

Code Comparison

Flannel configuration example:

net-conf.json:
  {
    "Network": "10.244.0.0/16",
    "Backend": {
      "Type": "vxlan"
    }
  }

CNI configuration example:

{
  "cniVersion": "0.4.0",
  "name": "mynet",
  "type": "bridge",
  "bridge": "cni0",
  "ipam": {
    "type": "host-local",
    "subnet": "10.244.0.0/16"
  }
}

Summary

Flannel is simpler and easier to set up, making it ideal for smaller deployments or beginners. CNI offers more flexibility and standardization, suitable for complex environments and advanced users. Flannel focuses on providing a flat network, while CNI allows for various networking solutions through its plugin architecture.

6,557

Cloud native networking and network security

Pros of Calico

  • Advanced network policy features for fine-grained control
  • Better performance and scalability for large clusters
  • Supports multiple data planes (e.g., eBPF, standard Linux)

Cons of Calico

  • More complex setup and configuration
  • Steeper learning curve for network administrators
  • Requires more resources compared to simpler solutions

Code Comparison

Flannel configuration (simple):

net-conf.json:
{
  "Network": "10.244.0.0/16",
  "Backend": {
    "Type": "vxlan"
  }
}

Calico configuration (more detailed):

apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
  name: default-ipv4-ippool
spec:
  cidr: 192.168.0.0/16
  ipipMode: Always
  natOutgoing: true

Flannel focuses on simplicity and ease of use, making it suitable for smaller clusters or those new to Kubernetes networking. Calico offers more advanced features and better performance at the cost of increased complexity, making it ideal for larger, production-grade clusters with specific networking requirements.

22,159

eBPF-based Networking, Security, and Observability

Pros of Cilium

  • Advanced network policy enforcement with Layer 7 (HTTP/gRPC) visibility
  • Built-in load balancing and service mesh capabilities
  • Better performance and scalability due to eBPF technology

Cons of Cilium

  • Steeper learning curve and more complex setup
  • Requires newer kernel versions for full functionality
  • Higher resource consumption compared to simpler CNI plugins

Code Comparison

Flannel configuration (simplified):

net-conf.json:
  {
    "Network": "10.244.0.0/16",
    "Backend": {
      "Type": "vxlan"
    }
  }

Cilium configuration (simplified):

cilium-config:
  enable-ipv4: true
  enable-ipv6: false
  tunnel: vxlan
  identity-allocation-mode: crd
  debug: "false"
  enable-endpoint-health-checking: "true"

Summary

Cilium offers more advanced networking features and better performance, but comes with increased complexity and resource requirements. Flannel is simpler to set up and use, making it suitable for basic networking needs. The choice between them depends on specific use cases and requirements of the Kubernetes cluster.

6,626

Simple, resilient multi-host containers networking and more.

Pros of Weave

  • Provides network encryption and supports network policy for enhanced security
  • Offers multicast support, which is beneficial for certain applications
  • Includes a built-in DNS server for service discovery

Cons of Weave

  • Generally slower performance compared to Flannel
  • More complex setup and configuration process
  • Higher resource consumption, especially in larger clusters

Code Comparison

Flannel configuration example:

net-conf.json: |
  {
    "Network": "10.244.0.0/16",
    "Backend": {
      "Type": "vxlan"
    }
  }

Weave configuration example:

command:
  - /home/weave/launch.sh
  - --ipalloc-range=10.32.0.0/12
  - --service-cidr=10.96.0.0/12

Both Flannel and Weave are popular networking solutions for Kubernetes clusters. Flannel is known for its simplicity and ease of use, while Weave offers more advanced features at the cost of increased complexity. The choice between the two depends on specific project requirements, such as security needs, performance expectations, and the level of networking expertise available in the team.

9,167

flannel is a network fabric for containers, designed for Kubernetes

Pros of Flannel

  • Actively maintained with regular updates and bug fixes
  • Well-documented with extensive user guides and examples
  • Supports multiple backend options for flexibility

Cons of Flannel

  • Limited advanced networking features compared to some alternatives
  • May have performance overhead in certain scenarios
  • Configuration can be complex for advanced use cases

Code Comparison

Flannel configuration example:

net-conf.json: |
  {
    "Network": "10.244.0.0/16",
    "Backend": {
      "Type": "vxlan"
    }
  }

Note: As both repositories mentioned in the prompt are the same (flannel-io/flannel), there isn't a different codebase to compare against. The code example provided is a typical Flannel configuration.

Flannel is a popular networking solution for Kubernetes clusters, providing a simple and efficient way to configure a layer 3 network fabric. It's designed to give a flat network model and is often used in conjunction with container runtimes like Docker.

While Flannel offers ease of use and broad compatibility, users with complex networking requirements may need to consider more feature-rich alternatives. However, for many standard Kubernetes deployments, Flannel provides a solid foundation for container networking.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

flannel

flannel Logo

Build Status

Flannel is a simple and easy way to configure a layer 3 network fabric designed for Kubernetes.

How it works

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.

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.

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 is focused on networking. For network policy, other projects such as Calico can be used.

Getting started on Kubernetes

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. For example, K3s sets up flannel in the Kubernetes clusters it creates using the open source K3s Installer to drive the setup process.

Though not required, it's recommended that flannel uses the Kubernetes API as its backing store which avoids the need to deploy a discrete etcd cluster for flannel. This flannel mode is known as the kube subnet manager.

Deploying flannel manually

Flannel can be added to any existing Kubernetes cluster though it's simplest to add flannel before any pods using the pod network have been started.

For Kubernetes v1.17+

Deploying Flannel with kubectl

kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml

If you use custom podCIDR (not 10.244.0.0/16) you first need to download the above manifest and modify the network to match your one.

Deploying Flannel with helm

# Needs manual creation of namespace to avoid helm error
kubectl create ns kube-flannel
kubectl label --overwrite ns kube-flannel pod-security.kubernetes.io/enforce=privileged

helm repo add flannel https://flannel-io.github.io/flannel/
helm install flannel --set podCidr="10.244.0.0/16" --namespace kube-flannel flannel/flannel

See Kubernetes for more details.

In case a firewall is configured ensure to enable the right port used by the configured backend.

Flannel uses portmap as CNI network plugin by default; when deploying Flannel ensure that the CNI Network plugins are installed in /opt/cni/bin the latest binaries can be downloaded with the following commands:

ARCH=$(uname -m)
  case $ARCH in
    armv7*) ARCH="arm";;
    aarch64) ARCH="arm64";;
    x86_64) ARCH="amd64";;
  esac
mkdir -p /opt/cni/bin
curl -O -L https://github.com/containernetworking/plugins/releases/download/v1.7.1/cni-plugins-linux-$ARCH-v1.7.1.tgz
tar -C /opt/cni/bin -xzf cni-plugins-linux-$ARCH-v1.7.1.tgz

Flannel requires the br_netfilter module to start and from version 1.30 kubeadm doesn't check if the module is installed and Flannel will not rightly start in case the module is missing.

Getting started on Docker

flannel is also widely used outside of kubernetes. When deployed outside of kubernetes, etcd is always used as the datastore. For more details integrating flannel with Docker see Running

Documentation

Contact

Community Meeting

The Flannel Maintainer Community runs a meeting on every other Thursday at 8:30 AM PST. This meeting is used to discuss issues, open pull requests, and other topics related to Flannel should the need arise.

The meeting agenda and Teams link can be found here: Flannel Community Meeting Agenda

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

Reporting bugs

See reporting bugs for details about reporting any issues.

Licensing

Flannel is under the Apache 2.0 license. See the LICENSE file for details.