<p>I am getting this result for flannel service on my slave node.  Flannel is running fine on master node.</p>

<pre><code>kube-system   kube-flannel-ds-amd64-xbtrf      0/1     CrashLoopBackOff   4          3m5s
</code></pre>

<p>Kube-proxy running on the slave is fine but not the flannel pod.</p>

<p>I have a master and a slave node only.  At first its say <code>running</code>, then it goes to <code>error</code> and finally, <code>crashloopbackoff</code>.</p>

<pre><code>godfrey@master:~$ kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                             READY   STATUS             RESTARTS   AGE     IP                NODE     NOMINATED NODE   READINESS GATES
kube-system   kube-flannel-ds-amd64-jszwx      0/1     CrashLoopBackOff   4          2m17s   192.168.152.104   slave3   &lt;none&gt;           &lt;none&gt;
kube-system   kube-proxy-hxs6m                 1/1     Running            0          18m     192.168.152.104   slave3   &lt;none&gt;           &lt;none&gt;
</code></pre>

<p>I am also getting this from the logs:</p>

<pre><code>I0515 05:14:53.975822       1 main.go:390] Found network config - Backend type: vxlan
I0515 05:14:53.975856       1 vxlan.go:121] VXLAN config: VNI=1 Port=0 GBP=false Learning=false DirectRouting=false
E0515 05:14:53.976072       1 main.go:291] Error registering network: failed to acquire lease: node "slave3" pod cidr not assigned
I0515 05:14:53.976154       1 main.go:370] Stopping shutdownHandler...
</code></pre>

<p>I could not find a solution so far.  Help appreciated.</p>

<p>The described cluster configuration doesn't look correct in two aspects:</p>

<hr>

<p>First of all, <code>PodCIDR</code> reasonable minimum subnet size is <code>/16</code>. Each Kubernetes node usually gets <code>/24</code> subnet because it can run up to 100 pods.<br>
<code>PodCIDR</code> and <code>ServicesCIDR</code> (default: "10.96.0.0/12") must not interfere with your existing LAN network and with each other.  </p>

<p>So, correct <code>kubeadm</code> command would look like:</p>

<pre><code>$ sudo kubeadm init --pod-network-cidr=10.244.0.0/16
</code></pre>

<p>In your case <code>PodCIDR</code> subnet is only <code>/24</code> and it was assigned to master node. Slave node didn't get its own <code>/24</code> subnet, so Flannel Pod showed the error in the logs:</p>

<pre><code>Error registering network: failed to acquire lease: node "slave3" pod cidr not assigned
</code></pre>

<p>Assigning the same subnet to several nodes manually will lead to the other connectivity problems.</p>

<p>You can find more details on Kubernetes IP subnets in <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr" rel="nofollow noreferrer">GKE documentation</a>.</p>

<hr>

<p>The second problem is the IP subnet number.  </p>

<p>Recent <a href="https://docs.projectcalico.org/getting-started/kubernetes/quickstart" rel="nofollow noreferrer">Calico</a> network addon versions are able to detect the correct Pod subnet based on <code>kubeadm</code> parameter <code>--pod-network-cidr</code>. Older version was using predefined subnet <code>192.168.0.0/16</code> and you had to adjust it in its YAML file in the <code>Deaemonset</code> specification :</p>

<pre><code>         - name: CALICO_IPV4POOL_CIDR
           value: "192.168.0.0/16"
</code></pre>

<p><a href="https://github.com/coreos/flannel/blob/master/Documentation/kubernetes.md#kubeadm" rel="nofollow noreferrer">Flannel</a> is still requires default subnet ( <code>10.244.0.0/16</code> ) to be specified for <code>kubeadm init</code>.<br>
To use custom subnet for your cluster, <code>Flannel</code> "installation" YAML file should be adjusted before applying to the cluster.  </p>

<pre><code>...
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
...
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }
...
</code></pre>

<p>So the following should work for any version of Kubernetes and Calico:</p>

<pre><code>$ sudo kubeadm init --pod-network-cidr=192.168.0.0/16
$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

# Latest Calico version
$ kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

# or specific version, v3.14 in this case, which is also latest at the moment
# kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
</code></pre>

<p>Same for Flannel:</p>

<pre><code>$ sudo kubeadm init --pod-network-cidr=10.244.0.0/16
$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

# For Kubernetes v1.7+ 
$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml    

# For older versions of Kubernetes:
# For RBAC enabled clusters:
$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-legacy.yml
$ 
</code></pre>

<p>There are many other network addons. You can find the list in the documentation:</p>

<ul>
<li><a href="https://kubernetes.io/docs/concepts/cluster-administration/networking/" rel="nofollow noreferrer">Cluster Networking</a> </li>
<li><a href="https://kubernetes.io/docs/concepts/cluster-administration/addons/#networking-and-network-policy" rel="nofollow noreferrer">Installing Addons</a></li>
</ul>
