Flannel Documentation

repository·master·Indexed 27 days ago

https://github.com/flannel-io/flannel

A simple layer 3 network fabric for Kubernetes that manages cluster-wide IPv4 networks by allocating subnets to hosts. It supports multiple backend mechanisms including VXLAN, host-gw, WireGuard, UDP, IPIP, IPSec, and TencentCloud VPC. Documentation covers installation via Helm and kubectl, CNI plugin setup, building from source, and network configuration options.

Tokens
11.9K
Snippets
28
Records
76
Agent score
94%

What's inside Flannel

  1. Understand the kube-flannel.yaml manifest components

    master

    The standard kube-flannel.yaml manifest deploys the following components:

    1. kube-flannel Pod: Set to privileged PodSecurity level.
    2. RBAC: ClusterRole and ClusterRoleBinding for permissions.
    3. Service Account: Dedicated account for flannel.
    4. ConfigMap: Contains CNI configuration and flannel configuration. The network key in the flannel configuration must match your pod network CIDR. The backend defaults to VXLAN.
    5. DaemonSet: Deploys the flannel pod on every node. It includes the flannel daemon container and an initContainer to deploy CNI configurations for the kubelet.
  2. Deploy Flannel with PodSecurityPolicy (Kubernetes <= v1.24)

    master

    If you are running a Kubernetes version $\le$ v1.24 and wish to continue using the deprecated PodSecurityPolicy API, use the kube-flannel-psp.yaml manifest instead of the standard kube-flannel.yaml.

    Note: Using this on Kubernetes $\ge$ v1.21 will trigger deprecation warnings.

  3. Perform an 'on the fly' Flannel upgrade

    master

    This is a less disruptive way to change the Flannel version. However, some versions may include changes that require manual resource comparison, cleanup, or renaming.

    If upgrading to a version newer than 0.20.2, you can use kubectl apply to update the deployment. If you encounter errors related to labeling, you must use the 'clean removal' method instead.

    kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml
  4. Install CNI Network Plugins for Flannel

    master

    Flannel uses portmap as its CNI network plugin by default. You must ensure that the CNI network plugins are installed in /opt/cni/bin. The following commands detect your architecture and install the latest v1.7.1 plugins.

    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
  5. Create a subnet reservation in etcd

    master

    A reservation is a fixed subnet assigned to a host that does not expire. You can convert an existing lease into a reservation by removing its TTL (Time To Live) in etcd. This is done by performing an etcdctl put operation on the subnet key without providing a --lease option.

    # update the value without any lease option (--lease).
    $ export ETCDCTL_API=3
    $ etcdctl put /coreos.com/network/subnets/10.5.1.0-24 $(etcdctl get /coreos.com/network/subnets/10.5.1.0-24)
  6. Report a bug in flannel

    master

    If you encounter bugs or documentation mistakes, open an issue at the flannel issue tracker.

    To ensure your report is actionable, follow these guidelines:

    • Specific: Include version, environment, and configuration details.
    • Reproducible: Provide clear steps to reproduce the problem.
    • Isolated: Minimize dependencies to isolate the bug to flannel itself.
    • Unique: Check for existing issues to avoid duplicates.
    • Scoped: Submit only one bug per report.