Kubernetes (gke) get name of pod network interface

7/9/2018

I'm trying to locate a performance issue that might be network related. Therefore I want to inspect all packets entering and leaving a pod.

I'm on kubernetes 1.8.12 on GKE. I ssh to the host and I see the bridge called cbr0 that sees all the traffic. I also see a ton of interfaces named like vethdeadbeef@if3. I assume those are virtual interfaces that are created per container. Where do I look to find out which interface belongs to which container, so I can get all a list of all the interfaces of a pod.

-- tback
docker
google-kubernetes-engine
kubernetes
networking

1 Answer

7/9/2018

If you have cat available in the container, you can compare the interface index of the containers eth0 with those of the veth* devices on your host. For example:

# grep ^ /sys/class/net/vet*/ifindex | grep ":$(docker exec aea243a766c1 cat /sys/class/net/eth0/iflink)"
/sys/class/net/veth1d431c85/ifindex:92

veth1d431c85 is what your are looking for.

-- jayme
Source: StackOverflow