Answers: <p>I figured it out by reading the documentation:</p>
  <blockquote>
  <p>Take care that your Pod network must not overlap with any of the host networks: you are likely to see problems if there is any overlap.</p>
  </blockquote>
  <p>Flannel uses 10.244.0.0/16 and can't run on the same as your host... it creates new interfaces when implemented. So when you run this init command it should always be using 10.244.0.0/16.</p>
  <pre><code>sudo kubeadm init --pod-network-cidr=10.244.0.0/16
  </code></pre>
  <p>Once I did this, things started working as expected.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-09-22T14:52:43.230Z
Answers: 2022-09-22T15:37:08.410Z
Answers: 2022-09-22T15:37:08.410Z
Answers: tmustang804
Body: <p>I'm trying to configure Kubernetes with web dashboard. I use these steps:</p>
  <pre class="lang-shell prettyprint-override"><code>swapoff -a
  </code></pre>
  <p>Remove following line from <code>/etc/fstab</code></p>
  <pre class="lang-shell prettyprint-override"><code>/swap.img       none    swap    sw      0       0
  </code></pre>
  <p>then run these shell commands:</p>
  <pre class="lang-shell prettyprint-override"><code>sudo apt update
  sudo apt install docker.io
  sudo systemctl start docker
  sudo systemctl enable docker 
  sudo apt install apt-transport-https curl
  curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
  echo &quot;deb https://apt.kubernetes.io/ kubernetes-xenial main&quot; &gt;&gt; ~/kubernetes.list
  sudo mv ~/kubernetes.list /etc/apt/sources.list.d
  sudo apt update
  sudo apt install kubeadm kubelet kubectl kubernetes-cni
      
  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
  </code></pre>
  <p>I applied this configuration:</p>
  <pre class="lang-yaml prettyprint-override"><code>kind: ClusterRoleBinding
  apiVersion: rbac.authorization.k8s.io/v1
  metadata:
    name: flannel-fix
  roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: flannel
  subjects:
    - kind: ServiceAccount
      name: flannel
      namespace: kube-flannel
  </code></pre>
  <pre class="lang-shell prettyprint-override"><code>kubectl create -f &lt;file&gt;
  </code></pre>
  <p>But I get:</p>
  <pre class="lang-shell prettyprint-override"><code>Error registering network: failed to acquire lease: subnet &quot;10.244.0.0/16&quot; specified in the flannel net config doesn't contain &quot;192.168.0.0/24&quot; PodCIDR of the &quot;ubuntukubernetis1&quot; node
  </code></pre>
  <p>Do you know what should be the correct configuration?</p>
  
Comments: CC BY-SA 4.0
Comments: 2022-07-25T06:25:31.930Z
Comments: Does this answer your question? [Cannot start Kubernetis Dashboard](https://devops.stackexchange.com/questions/16335/cannot-start-kubernetis-dashboard)
Comments: SYN
Tags: <kubernetes>
Title: failed to acquire lease: subnet "10.244.0.0/16" specified in the flannel net config doesn't contain "192.168.0.0/24"
UserDisplayName: Peter Penzov
ThreadText: # failed to acquire lease: subnet "10.244.0.0/16" specified in the flannel net config doesn't contain "192.168.0.0/24"
  
  (Asked by: username_0 on 2022-07-24)
  
  I'm trying to configure Kubernetes with web dashboard. I use these steps:
  
  ```shell
  swapoff -a
  
  ```
  
  Remove following line from `/etc/fstab`
  
  ```shell
  /swap.img       none    swap    sw      0       0
  
  ```
  
  then run these shell commands:
  
  ```shell
  sudo apt update
  sudo apt install docker.io
  sudo systemctl start docker
  sudo systemctl enable docker 
  sudo apt install apt-transport-https curl
  curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
  echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" >> ~/kubernetes.list
  sudo mv ~/kubernetes.list /etc/apt/sources.list.d
  sudo apt update
  sudo apt install kubeadm kubelet kubectl kubernetes-cni
      
  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
  
  ```
  
  I applied this configuration:
  
  ```yaml
  kind: ClusterRoleBinding
  apiVersion: rbac.authorization.k8s.io/v1
  metadata:
    name: flannel-fix
  roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: flannel
  subjects:
    - kind: ServiceAccount
      name: flannel
      namespace: kube-flannel
  
  ```
  
  ```shell
  kubectl create -f <file>
  
  ```
  
  But I get:
  
  ```shell
  Error registering network: failed to acquire lease: subnet "10.244.0.0/16" specified in the flannel net config doesn't contain "192.168.0.0/24" PodCIDR of the "ubuntukubernetis1" node
  
  ```
  
  Do you know what should be the correct configuration?
  
  **Tags:** kubernetes
  
  > **Comments:**
  > **username_1**: Does this answer your question? [Cannot start Kubernetis Dashboard](https://devops.stackexchange.com/questions/16335/cannot-start-kubernetis-dashboard)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-09-22. Score: 1
  
  I figured it out by reading the documentation:
  
  > Take care that your Pod network must not overlap with any of the host networks: you are likely to see problems if there is any overlap.
  
  Flannel uses 10.244.0.0/16 and can't run on the same as your host... it creates new interfaces when implemented. So when you run this init command it should always be using 10.244.0.0/16.
  
  ```
  sudo kubeadm init --pod-network-cidr=10.244.0.0/16
  
  ```
  
  Once I did this, things started working as expected.
  
  
  ---
  
  