Is there anyway I can read the configured vxlan VNI and vxlan port for calico CNI plugin in Kubernetes Cluster?

11/8/2021

I have a Kubernetes cluster with Calico Networking and vxlan mode enabled. I want to know what is the VNI and vxlan port number being used by the CNI. I know I can get it by capturing traffic and looking into the packet. But I wanted to know if there is a way to get these values through kubectl or any specific API which I can use in python or go client for kubernetes.

-- Ahamed
calico
kubernetes

1 Answer

11/15/2021

I believe there is no single API for checking those values.

Those VXLAN settings are controlled by vxlanPort and vxlanVNI which are described here: https://docs.projectcalico.org/reference/resources/felixconfig

And as described in https://docs.projectcalico.org/reference/felix/configuration, a felixconfig value can be defined in one of 4 places: 1. Environment variables (on the calico-node daemonset) 2. The Felix configuration file (not typically used in a kubernetes cluster) 3. Host-specific FelixConfiguration resources (node.<nodename>). 4. The global FelixConfiguration resource (default).

That's also the order of precedence, i.e. env vars override everything else, etc.

The only other way to check would be to get the logs for the calico-node pod in question - calico-node pods output their detected configuration at start of day in one of their first few logs.

-- lwr20
Source: StackOverflow