Flannel installation on Kubernetes
Asked Answered
U

3

5

I have installed fresh Kubernetes 1.6.2 master on a single host and now trying to start Flannel using https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml

The pod does not come up:

$ kubectl get pods kube-flannel-ds-l6gn4 --namespace kube-system   
NAME                    READY     STATUS             RESTARTS   AGE
kube-flannel-ds-l6gn4   1/2       CrashLoopBackOff   36         2h

$ kubectl logs kube-flannel-ds-l6gn4 --namespace kube-system kube-flannel
E0427 15:35:52.232093       1 main.go:127] Failed to create 
SubnetManager: error retrieving pod spec for 'kube-system/kube-flannel-ds-l6gn4': the server does not allow access to the requested resource (get pods kube-flannel-ds-l6gn4)

I've also tried this using the default serviceaccount, but it won't come up.

Ulani answered 27/4, 2017 at 15:39 Comment(0)
L
6

If you are using the RBAC authorizer, you also need to create https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel-rbac.yml to set up the role and permissions for the flannel service account

Leilaleilah answered 27/4, 2017 at 17:26 Comment(0)
L
10

Note that to install Kubernetes with flannel you need to specify the --pod-network-cidr flag. See kubeadm init section

Example

kubeadm init --pod-network-cidr=10.244.0.0/16

then as Menionned by Jordan, on some environments you need to install RBAC

kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel-rbac.yml

If you are still having issues check that

  1. Make sure your cni plugin binaries are in place in /opt/cni/bin. You should see corresponding binaries for each CNI add-on

  2. Make sure the CNI configuration file for the network add-on is in place under /etc/cni/net.d [root@node1]# ls /etc/cni/net.d 10-flannel.conf

  3. Run ifconfig to check docker, flannel bridge and virtual interfaces are up

as mentionned here on github https://github.com/kubernetes/kubernetes/issues/36575#issuecomment-264622923

I have written a complete blog post on the topic if it can help.

Licko answered 29/5, 2017 at 14:29 Comment(2)
gist link brokenJamaaljamaica
They moved RBAC to Legacy, therefore, you might want use raw.githubusercontent.com/coreos/flannel/master/Documentation/… .Kilan
L
6

If you are using the RBAC authorizer, you also need to create https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel-rbac.yml to set up the role and permissions for the flannel service account

Leilaleilah answered 27/4, 2017 at 17:26 Comment(0)
B
4

For anyone who may be looking for this more recently, the most recent docs state that the correct provisioning command (For RBAC-enabled 1.7+) is:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Note that there are also instruction docs for older versions/without RBAC, which state:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-legacy.yml

Note that to install RBAC on top of the older version:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
Burkhart answered 21/10, 2018 at 23:52 Comment(1)
RBAC links are expired, what's the new one?Cecilia

© 2022 - 2024 — McMap. All rights reserved.