For information on deploying flannel manually, using the Kubernetes installer toolkit kubeadm, see Installing Kubernetes on Linux with kubeadm.
NOTE: If kubeadm
is used, then pass --pod-network-cidr=10.244.0.0/16
to kubeadm init
to ensure that the podCIDR
is set.
kubeadm has RBAC enabled by default so you must apply the kube-flannel-rbac.yml
manifest as well as the kube-flannel.yml
manifest.
kubectl apply -f kube-flannel-rbac.yml -f kube-flannel.yml
If you didn't apply the kube-flannel-rbac.yml
manifest, you'll see errors in your flanneld logs about failing to connect.
Failed to create SubnetManager: error retrieving pod spec...
If you forgot to apply the kube-flannel-rbac.yml
manifest and notice that flannel fails to start, then it is safe to just apply the kube-flannel-rbac.yml
manifest without running kubectl delete -f kube-flannel.yaml
first.
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel-rbac.yml
The flannel
manifest defines three things:
- A service account for
flannel
to use. - A ConfigMap containing both a CNI configuration and a
flannel
configuration. Thenetwork
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.
The flannel CNI plugin can be found in the CNI plugins reposistory. For additional details, see the README
Kubernetes 1.6 requires CNI plugin version 0.5.1 or later.
See troubleshooting