1

Every node in a kubernetes cluster has a dedicated range of IP addresses that it can allocate to the pods. How can one check what that IP range is?

2 Answers2

1

You can do something like this

[root@kmaster ~]# k get nodes
NAME                 STATUS   ROLES           AGE   VERSION
kmaster.mylab.edu    Ready    control-plane   26h   v1.25.4
kworker0.mylab.edu   Ready    <none>          25h   v1.25.4
kworker1.mylab.edu   Ready    <none>          25h   v1.25.4
[root@kmaster ~]# k describe node | egrep -w  "PodCIDR:|Name:"
Name:               kmaster.mylab.edu
PodCIDR:                      10.244.0.0/24
Name:               kworker0.mylab.edu
PodCIDR:                      10.244.1.0/24
Name:               kworker1.mylab.edu
PodCIDR:                      10.244.3.0/24
[root@kmaster ~]#
Uday
  • 11
  • 2
0

One of the ways is to check etcd.

oc rsh -n openshift-etcd etcd-master02

To check pod range allocated to a particular node:

etcdctl get /kubernetes.io/network.openshift.io/hostsubnets/master01

In the output you will see a subnet, e.g. "10.8.2.0/23" `

To list allocations for all cluster nodes:

etcdctl get --prefix /kubernetes.io/network.openshift.io/hostsubnets/

  • you can check the pod allocated ip range in kube-api manifest file if you are running local kubernetes cluster. – asmath Oct 11 '22 at 04:37