Answers: <p>This was caused by missing <code>--network-plugin=cni</code> on the end of kubelet. Added that to the args and it all works now.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-05-21T06:49:16.493Z
Answers: Hello Alex. I am facing exactly same issue in my cluster. Same range of unexpected CIDR is used for IP allocation. Can you share some detail how did you pass  --network-plugin=cni in kubelet.  I install kubelet by apt-get install kubelet. I am new to kubernetes. Thanks in advance.
Answers: Mufazzal
Answers: CC BY-SA 4.0
Answers: 2023-10-26T20:47:49.310Z
Answers: Sorry, I don't check my account often. I'm on gentoo and there it's in the /etc/conf.d/kubelet file. However I'm pretty sure it's not going to be the same on a debian based distro, sorry (esp to anyone else who comes across this).
Answers: Alex Orange
Answers: CC BY-SA 4.0
Answers: 2019-10-25T02:37:10.837Z
Answers: 2019-10-25T02:37:10.837Z
Answers: Alex Orange
Body: <p>I'm running kubernetes with the supposed pod network cidr of <code>10.244.0.0/16</code>. Everything seems to agree with that:</p>
  
  <pre><code># history | grep kubeadm
  kubeadm init --control-plane-endpoint "guide:6443" --upload-certs --pod-network-cidr=10.244.0.0/16
  
  $ kubectl get nodes -o kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}'
  10.244.0.0/24 10.244.1.0/24 10.244.2.0/24 10.244.3.0/24 10.244.4.0/24 10.244.5.0/24
  
  # cat /run/flannel/subnet.env 
  FLANNEL_NETWORK=10.244.0.0/16
  FLANNEL_SUBNET=10.244.0.1/24
  FLANNEL_MTU=1450
  FLANNEL_IPMASQ=true
  </code></pre>
  
  <p>However all the pods I create get IPs in the 172.17.0.0/16 range.</p>
  
  <pre><code>$ kubectl get pods -o wide
  NAME                                   READY   STATUS             RESTARTS   AGE   IP            NODE         NOMINATED NODE   READINESS GATES
  busybox1                               1/1     Running            1          13m   172.17.0.11   k8s-node-1   &lt;none&gt;           &lt;none&gt;
  debain-shell-547f8fc54b-v8p99          0/1     ImagePullBackOff   0          27m   172.17.0.3    k8s-node-1   &lt;none&gt;           &lt;none&gt;
  nginx-deployment-ex-54f57cf6bf-k55nn   1/1     Running            1          27m   172.17.0.5    k8s-node-1   &lt;none&gt;           &lt;none&gt;
  nginx-deployment-ex-54f57cf6bf-q2khx   1/1     Running            1          27m   172.17.0.9    k8s-node-1   &lt;none&gt;           &lt;none&gt;
  nginx-deployment-ex-54f57cf6bf-r8b7v   1/1     Running            1          27m   172.17.0.7    k8s-node-1   &lt;none&gt;           &lt;none&gt;
  </code></pre>
  
  <p>I can't talk to coredns (which is how I found this condition) and I can't seem to use my ingress service anymore (though I've restarted enough things by now I may have just temporarily broken that).</p>
  
  <p>What is causing this, or alternatively, where should I look for more info?</p>
  
Tags: <docker><kubernetes>
Title: kubernetes allocating pods with the wrong IP
UserDisplayName: Alex Orange
ThreadText: # kubernetes allocating pods with the wrong IP
  
  (Asked by: username_0 on 2019-10-25)
  
  I'm running kubernetes with the supposed pod network cidr of `10.244.0.0/16`. Everything seems to agree with that:
  
  ```
  # history | grep kubeadm
  kubeadm init --control-plane-endpoint "guide:6443" --upload-certs --pod-network-cidr=10.244.0.0/16
  
  $ kubectl get nodes -o kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}'
  10.244.0.0/24 10.244.1.0/24 10.244.2.0/24 10.244.3.0/24 10.244.4.0/24 10.244.5.0/24
  
  # cat /run/flannel/subnet.env 
  FLANNEL_NETWORK=10.244.0.0/16
  FLANNEL_SUBNET=10.244.0.1/24
  FLANNEL_MTU=1450
  FLANNEL_IPMASQ=true
  
  ```
  
  However all the pods I create get IPs in the 172.17.0.0/16 range.
  
  ```
  $ kubectl get pods -o wide
  NAME                                   READY   STATUS             RESTARTS   AGE   IP            NODE         NOMINATED NODE   READINESS GATES
  busybox1                               1/1     Running            1          13m   172.17.0.11   k8s-node-1   <none>           <none>
  debain-shell-547f8fc54b-v8p99          0/1     ImagePullBackOff   0          27m   172.17.0.3    k8s-node-1   <none>           <none>
  nginx-deployment-ex-54f57cf6bf-k55nn   1/1     Running            1          27m   172.17.0.5    k8s-node-1   <none>           <none>
  nginx-deployment-ex-54f57cf6bf-q2khx   1/1     Running            1          27m   172.17.0.9    k8s-node-1   <none>           <none>
  nginx-deployment-ex-54f57cf6bf-r8b7v   1/1     Running            1          27m   172.17.0.7    k8s-node-1   <none>           <none>
  
  ```
  
  I can't talk to coredns (which is how I found this condition) and I can't seem to use my ingress service anymore (though I've restarted enough things by now I may have just temporarily broken that).
  
  What is causing this, or alternatively, where should I look for more info?
  
  **Tags:** docker, kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-10-25. Score: 2
  
  This was caused by missing `--network-plugin=cni` on the end of kubelet. Added that to the args and it all works now.
  
  > **Comments:**
  > **username_1**: Hello username_0. I am facing exactly same issue in my cluster. Same range of unexpected CIDR is used for IP allocation. Can you share some detail how did you pass  --network-plugin=cni in kubelet.  I install kubelet by apt-get install kubelet. I am new to kubernetes. Thanks in advance.  
  > **username_0**: Sorry, I don't check my account often. I'm on gentoo and there it's in the /etc/conf.d/kubelet file. However I'm pretty sure it's not going to be the same on a debian based distro, sorry (esp to anyone else who comes across this).  
  
  ---
  
  