<p>I am bit confused about Calico IPs : </p>

<p>If I add calico to kubernetes cluster using </p>

<pre><code>kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
</code></pre>

<p>The CALICO_IPV4POOL_CIDR is 192.168.0.0/16
So IP Range is 192.168.0.0 to 192.168.255.255</p>

<p>Now I have initiated the cluster using : </p>

<pre><code>kubeadm init --pod-network-cidr=20.96.0.0/12 --apiserver-advertise-address=192.168.56.30
</code></pre>

<p>So, now pods will have IP address (using pod network CIDR) will be between: 20.96.0.0 to 20.111.255.255</p>

<p>What are these two different IPs. My Pods are getting IP addresses 20.96.205.192 and so on.</p>

Ankit Bansal
<ul>
<li>The <code>CALICO_IPV4POOL_CIDR</code> is <code>#commented</code> by default, look at these lines in <a href="https://docs.projectcalico.org/v3.14/manifests/calico.yaml" rel="noreferrer">calico.yaml</a>:</li>
</ul>
<pre><code># The default IPv4 pool to create on startup if none exists. Pod IPs will be
# chosen from this range. Changing this value after installation will have
# no effect. This should fall within `--cluster-cidr`.
# - name: CALICO_IPV4POOL_CIDR
#   value: &quot;192.168.0.0/16&quot;
</code></pre>
<p><strong>For all effects</strong>, unless manually modified before deployment, <strong>those lines are not considered during deployment</strong>.</p>
<ul>
<li>Another important line in the yaml itself is:</li>
</ul>
<blockquote>
<p># Pod CIDR auto-detection on kubeadm needs access to config maps.</p>
</blockquote>
<p>This confirms that the CIDR is obtained from the cluster, not from <code>calico.yaml</code>.</p>
<hr />
<blockquote>
<p>What are these two different IPs? My Pods are getting IP addresses 20.96.205.192 and so on.</p>
</blockquote>
<ul>
<li><p>Kubeadm supports many <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network" rel="noreferrer">Pod network add-ons</a>, Calico is one of those. Calico on the other hand is supported by many kinds of deployment, kubeadm is just one of those.</p>
</li>
<li><p>Kubeadm <code>--pod-network-cidr</code> in your deployment is the correct way to define the pod network CIDR, this is why the range <code>20.96.0.0/12</code> is effectively used.</p>
</li>
<li><p><code>CALICO_IPV4POOL_CIDR</code> is required for other kinds of deployment that does not specify the CIDR pool reservation for pod networks.</p>
</li>
</ul>
<hr />
<p><strong>Note:</strong></p>
<ul>
<li>The range <code>20.96.0.0/12</code> is not a <a href="https://en.wikipedia.org/wiki/Private_network" rel="noreferrer">Private Network</a> range, and it can cause problems if a client with a Public IP from that range tries to access your service.</li>
<li>The <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" rel="noreferrer">classless</a> reserved IP ranges for Private Networks are:
<ul>
<li>10.0.0.0/8 (16.777.216 addresses)</li>
<li>172.16.0.0/12 (1.048.576 addresses)</li>
<li>192.168.0.0/16 (65.536 addresses)</li>
</ul>
</li>
<li>You can use any subnet size inside these ranges for your POD CIDR Network, just make sure it doesn't overlaps with any subnet in your network.</li>
</ul>
<p><strong>Additional References:</strong></p>
<ul>
<li><a href="https://docs.projectcalico.org/getting-started/kubernetes/quickstart#create-a-single-host-kubernetes-cluster" rel="noreferrer">Calico - Create Single Host Kubernetes Cluster with Kubeadm</a></li>
<li><a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#tabs-pod-install-0" rel="noreferrer">Kubeadm Calico Installation</a></li>
<li><a href="https://www.rfc-editor.org/rfc/rfc1918#section-3" rel="noreferrer">IETF RFC1918 - Private Address Space</a></li>
</ul>
