<p>In the tutorial <a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/</a>, it says </p>

<blockquote>
  <p>For flannel to work correctly, you must pass <code>--pod-network-cidr=10.244.0.0/16</code> to <code>kubeadm init.</code>.</p>
</blockquote>

<p>How to pass other cidr, e.g., <code>--pod-network-cidr=192.168.0.0/16</code>?</p>

Leon
<p>Follow the same steps in the tutorial, except: </p>

<p>(1) After <code>kubeadm reset</code>, clear earlier net interfaces on both master and slave nodes.</p>

<pre><code>sudo ip link del cni0
sudo ip link del flannel.1
sudo systemctl restart network
</code></pre>

<p>(2) Run <code>kubeadm init --pod-network-cidr=192.168.0.0/16</code></p>

<p>(3) Download the <code>kube-flannel.yml</code> file, change hard coded <code>10.244.0.0</code> to <code>192.168.0.0</code>, then do <code>kubectl create -f kube-flannel.yml</code>.</p>

<p><strong>Test result</strong></p>

<pre><code>$ k get po -o=wide
NAME                         READY     STATUS    RESTARTS   AGE       IP             NODE
h2-75cb7756c6-r4gkj          1/1       Running   0          5m        192.168.1.14   slave1
h2-75cb7756c6-xfstk          1/1       Running   0          16m       192.168.0.5    master
jobserver-58bf6985f9-77mdd   1/1       Running   0          16m       192.168.0.6    master
jobserver-58bf6985f9-h9hlx   1/1       Running   0          5m        192.168.1.15   slave1

# ping pod on slave
$ ping 192.168.1.14  
PING 192.168.1.14 (192.168.1.14) 56(84) bytes of data.
64 bytes from 192.168.1.14: icmp_seq=1 ttl=63 time=0.454 ms

# ping pod on master
$ ping 192.168.0.5
PING 192.168.0.5 (192.168.0.5) 56(84) bytes of data.
64 bytes from 192.168.0.5: icmp_seq=1 ttl=64 time=0.143 ms

# ping docker container on the same node
$ ping 172.18.0.2    
PING 172.18.0.2 (172.18.0.2): 56 data bytes
64 bytes from 172.18.0.2: seq=0 ttl=241 time=21.580 ms
</code></pre>
