Logu
Logu

Reputation: 1024

How to list pod-network-cidr details

Is it possible to list the kubernetes CNI and pod-network-cidr details used on kubernetes cluster? Preferably using kubectl.

Upvotes: 3

Views: 2597

Answers (4)

Richard
Richard

Reputation: 271

kubectl describe nodes

Lot's of info including the cidr for the pod network on each node.

> kubectl describe nodes | grep CIDR
PodCIDR:                     10.42.2.0/24
PodCIDR:                     10.42.1.0/24
PodCIDR:                     10.42.0.0/24

Upvotes: 1

Mikołaj Głodziak
Mikołaj Głodziak

Reputation: 5277

I created a community wiki answer to summarize the topic.

As for the list of the installed CNI addons, you can follow this topic:

if you list the pods in kube-system namespace, you can see the pods. The pod's names will be started with weave-net-xxxxx. Since it is Deamonset object, the pod's count will be based on your k8s nodes. Actually one pod will be created for one node.

kubectl get pods -n kube-system

and the comment:

In addition to this answer you can also check which one you have by running command ls /etc/cni/net.d. It will show your cni's conf.

The example explained there is for weave CNI, because that was what OP asked for. In your case, the pods can be named differently, but the method of obtaining information about them is the same.

As for the second part of the question, user Jakub Siemaszko wrote a good answer. This command will actually returns pod CIDR addresses for each of the nodes in your cluster. If you are looking for another information about this topic please follow this doc.

Upvotes: 1

Jakub Siemaszko
Jakub Siemaszko

Reputation: 758

Additionally to the previous answer you can use:

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

to get pod CIDR addresses for each of the nodes in your cluster.

Upvotes: 3

Chandra Sekar
Chandra Sekar

Reputation: 763

If you list the pods in kube-system namespace, you can see the pods. The pod's names will be started with weave-net-xxxxx if you. Since it is Deamonset object, the pod's count will be based on your k8s nodes. Actually one pod will be created for one node. In addition to this you can also check which one you have by running command ls /etc/cni/net.d. It will show your cni's conf.

kubectl get pods -n kube-system

Upvotes: 0

Related Questions