<p>Is there any direct command to fetch the podcidr assigned to each node when using calico CNI.</p>
<p>I am looking for exact network and netmask assigned to each node. I am not able to fetch it from <code>kubectl get nodes</code> neither via <code>podCIDR value</code> nor via <code>projectcalico.org/IPv4VXLANTunnelAddr</code> annotation. Also looks like the annotation will also differ based on VXLAN or IPIP tunnel used by calico.</p>
<p>Tried to fetch via podCIDR key from nodes. Got the following output. Which wasn't the network assigned to the nodes.</p>
<pre><code>kubectl get nodes -oyaml | grep -i podcidr -B 1
  spec:
    podCIDR: 192.168.0.0/24
    podCIDRs:
--
  spec:
    podCIDR: 192.168.2.0/24
    podCIDRs:
</code></pre>
<p>Tried to fetch it via calico annotation. Was able to find the network but the netmask was missing.</p>
<pre><code>kubectl get nodes -oyaml | grep -i ipv4vxlan
      projectcalico.org/IPv4VXLANTunnelAddr: 192.168.33.64
      projectcalico.org/IPv4VXLANTunnelAddr: 192.168.253.192
</code></pre>
<p>Tried to fetch it via calico pod. Found the exact network and netmask i.e <strong>192.168.33.64/26</strong> from the calico log.</p>
<pre><code>kubectl logs calico-node-h2s9w   -n calico-system | grep cidr
2020-12-14 06:54:50.783 [INFO][18] tunnel-ip-allocator/ipam.go 140:
Attempting to load block cidr=192.168.33.64/26 host=&quot;calico-master&quot;

</code></pre>
<p>But i want to avoid looking at logs of calico pod on each node.
Is there a better way to find the podcidr assigned to each node via a single command.</p>

apoorva kamath
<p>You can use <code>etcdctl</code> to know details of subnet block assigned to each node.</p>
<pre><code>ETCDCTL_API=3 etcdctl ls /calico/ipam/v2/host/node1/ipv4/block/
</code></pre>
<p>Above example for a node <code>node1</code> will give something like below as output.</p>
<pre><code>/calico/ipam/v2/host/node1/ipv4/block/192.168.228.192-26
</code></pre>
