I have a running k8s cluster initialized with kubeadm.

On initialization, I did not pass the option --pod-network-cidr

How do I get the CIDR of the pod network

I tried

  • Looking at the /etc/kubernetes/manifests/kube-apiserver.yaml which seems to be the manifest for kube-apiserver used by kubeadm but that information is not included
  • Looking at the kubeadm document but I couldn't find a default value

This command will give you the pod CIDR addresses for each of the nodes in your cluster.

kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}'


This will show pod network CIDR which used by kube-proxy

kubectl cluster-info dump | grep -m 1 cluster-cidr
  • This returns nothing in my case. Oct 2 at 4:06

The --cluster-cidr / --pod-network-cidr is fed to kube-controller-manager config.

You can simply do ps -ef | grep "cluster-cidr" to get what you want.


It's in file /etc/kubernetes/manifests/kube-controller-manager.yaml

# sudo grep cidr /etc/kubernetes/manifests/kube-*
/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --allocate-node-cidrs=true
/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --cluster-cidr=
/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --node-cidr-mask-size=24

With kubeadm

kubeadm config view | grep Subnet

  • 1
    Thanks for posting an answer. Could you explain what is the difference with the other commands that were provided in the other answer and could you add an example of the output of this command?
    – 030
    Dec 27 '19 at 7:44

There are a few options (combining the existing answers and adding option for Calico, including example ouput):

Option 1: Run this command On the master node (also applicable when running for example microk8s on Ubuntu)

  • kubeadm config view | grep Subnet

example output from local 3 node cluster, master node


Option 2: Run this command on the master node:

  • ps -ef | grep cluster-cidr

example output from local machine running microk8s

vincent   6841 27089  0 09:52 pts/7    00:00:00 grep --color=auto cluster-cidr
root      7053     1  0 feb12 ?        00:00:14 /snap/microk8s/1173/kube-proxy --kubeconfig=/var/snap/microk8s/1173/credentials/proxy.config --cluster-cidr= --healthz-bind-address=

Option 3: Run this command on the master node:

  • sudo grep cidr /etc/kubernetes/manifests/kube-*

Example output of same master node:

/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --allocate-node-cidrs=true
/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --cluster-cidr=
/etc/kubernetes/manifests/kube-controller-manager.yaml:    - --node-cidr-mask-size=24

If you run Calico you have the option to use calicoctl:


This documentation shows how to show and also change the cidr: https://docs.projectcalico.org/v3.2/usage/changing-ip-pools

Option 4 (Calico): Run this command to view the cidr:

  • CALICO_KUBECONFIG=~/.kube/config DATASTORE_TYPE=kubernetes calicoctl get ippool -o wide

Example output for the same cluster (works from any place that has the proper kubectl config and connection to the cluster):

NAME                  CIDR            NAT    IPIPMODE   DISABLED   SELECTOR   
default-ipv4-ippool   true   Always     false      all()

Depending on your network option, you may have other options which are hopefully documented in the respective documentation.


my version of kubeadm is 1.22 and the command to view defaults is kubeadm config print init-defaults, towards the bottom:

  dnsDomain: cluster.local
New contributor
Paul42 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.