<p>I am running kubernetes(v1.7) and flannel(v0.9.0) which was installed using kubeadm.</p>

<p>I want to know that-</p>

<ol>
<li>How does a node get a subnet?</li>
<li>Where are all allocated subnets stored and how I can see them?</li>
<li>How does flannel interact with kubernetes?</li>
</ol>

<p>Thanks,</p>

<ol>
<li>flannel gives the POD IP address. network range is defined in <code>subnet.env</code> file</li>
</ol>

<blockquote>
<pre><code># cat /var/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>
</blockquote>

<ol start="2">
<li><p>Allocated IPs are stored in etcd database in the Master Node. you can query API server to view them</p></li>
<li><p>Flannel is a virtual network that gives a subnet to PODs. when Kubernetes start the pod it gets the IP address from flannel and assign to PODs</p></li>
</ol>

<p>you can look at the network info like this from etcd database.</p>

<pre><code> export ETCDCTL_API=3;  etcdctl get "/registry/configmaps/kube-system/kubeadm-config" --prefix=true
</code></pre>
