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

9 Answers 9


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}'

  • 3
    It's blank in my case "spec": {}, Commented Jan 9, 2020 at 10:42
  • It was blank in my case too earlier but passing --pod-network-cidr during kubeadm reinitialisation resolved this
    – ddlr
    Commented Nov 3, 2023 at 4:26
  • Unfortunately, that field is not always set in the Node structure.
    – allprog
    Commented May 24 at 12:28

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

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

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
  • 2
    This is the only answer here that worked for me (K8s v. 1.24.0) - thank you. Commented Aug 8, 2022 at 16:40
  • 1
    For me too, the only answer that works! Thanks! Commented Sep 15, 2022 at 22:09
  • Same for me too
    – ddlr
    Commented Nov 2, 2023 at 5:24
  • WARNING, I wanna put emphasis on the fact that this is NOT your actually configured cidr range for the cluster but only what kubeadm init defaults too. This works for OP because they didn't specify a pod cidr, but ONLY works in this case !
    – adamency
    Commented Mar 22 at 7:20

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
    Commented Dec 27, 2019 at 7:44
  • I get invalid subcommand: "view" kubeadm version: &version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.9", GitCommit:"6df4433e288edc9c40c2e344eb336f63fad45cd2", Commented May 29, 2022 at 4:09

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.


To get Service IP range - i.e. IP's assigned to ClusterIP, the command is:

  • ps -aux | grep kube-apiserver | grep service-cluster-ip-range (you can run this on master node)
  • cat /etc/kubernetes/manifests/kube-apiserver.yaml | grep service-cluster-ip-range

To find the Pod network range, when you have defined your cluster using kubeadm 1.22 and used weave as your networking addon: first find the weave pod name using

kubectl get pod -n kube-system | grep weave

Copy any one name out of the three pod names.

kubectl -n kube-system logs <<weave-net-podname-from-above-step>> -c weave | grep ipalloc-range

you will find either default i.e. or whatever range you assigned during kubeadm init


This works practically in any cluster:

kubectl create service clusterip testcidr \
          --tcp='8080:8080' --clusterip=''

error: failed to create ClusterIP service: Service "testcidr"
is invalid: spec.clusterIPs: Invalid value: []string{""}: 
failed to allocate IP the provided IP ( is not in 
the valid range. The range of valid IPs is

The idea is to try to create a service outside the allowed CIDR and the error message will contain the valid range.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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