├── debug-pod.yaml ├── README.md └── docker-veth.sh /debug-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: debug-pod 5 | labels: 6 | app: debug 7 | spec: 8 | hostNetwork: true 9 | hostPID: true 10 | containers: 11 | - name: debug-pod 12 | image: samos123/docker-toolbox:latest 13 | command: [ "/bin/bash", "-c", "--" ] 14 | args: [ "while true; do sleep 30; done;" ] 15 | volumeMounts: 16 | - name: dockersock 17 | mountPath: "/var/run/docker.sock" 18 | securityContext: 19 | allowPrivilegeEscalation: true 20 | privileged: true 21 | capabilities: 22 | add: ["NET_ADMIN"] 23 | volumes: 24 | - name: dockersock 25 | hostPath: 26 | path: /var/run/docker.sock 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Find veth interface of docker containers 2 | 3 | This repository contains a script for finding the veth interfaces of every 4 | container. For example you might see a lot of veth interfaces on a K8s node/ 5 | docker host, but you can't figure out which namespace or container the veth 6 | interface is associated with. This info can be helpful while debugging. 7 | The script `docker-veth.sh` can be run from a privileged container on the same 8 | node. 9 | 10 | ### Usage on K8s 11 | Run a privileged pod using the samos123/docker-toolbox image that already 12 | contains this script and other useful troubleshooting tools. 13 | 14 | ``` 15 | kubectl apply -f debug-pod.yaml 16 | kubectl exec debug-pod -t -i bash 17 | docker-veth.sh 18 | ``` 19 | -------------------------------------------------------------------------------- /docker-veth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | usage () { 5 | cat <