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.
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
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
Make sure your cni plugin binaries are in place in /opt/cni/bin. You should see corresponding binaries for each CNI add-on
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
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.
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