tcpdump for container

 

kubectl -n kube-system exec -it $pod -- ovs-vsctl list-ports br-int
ovnip=`ip a | grep "scope global ovn4nfv0" |awk '{match($0, /.+inet\s([^ /]*)/, a);print a[3];exit}'`
ifc=`ip a | grep "scope global ovn4nfv0" |awk '{match($0, /.+global\s([^ /]*)/, a);print a[1];exit}'`

# https://www.redhat.com/sysadmin/container-namespaces-nsenter
# https://www.thegeekdiary.com/how-to-access-docker-containers-network-namespace-from-host/
podn=sdewan-cnf  # cloud-gateway
pid=$(docker inspect -f '{{.State.Pid}}' $(docker ps -l -f name="$podn" -q))
mkdir -p /var/run/netns/
ln -sfT /proc/$pid/ns/net /var/run/netns/[$podn]
ip netns exec [$podn] ip a

# https://www.dasblinkenlichten.com/getting-started-with-calico-on-kubernetes/
# https://k8s.networkop.co.uk/cni/calico/

 

posted @ 2021-06-09 21:17  lvmxh  阅读(56)  评论(0编辑  收藏  举报