instructions on how to perform a packet capture of a container running on a TKGm node.
3.x
1. SSH to the node where the POD/Container is running
2. Identify the container
# crictl ps
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID PODxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running nodeconfig-daemon 9 xxxxxxxxxxxxx nodeconfig-daemon-b9b29xxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running coredns 1 xxxxxxxxxxxxx coredns-584c9f848-pd69hxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running calico-node 2 xxxxxxxxxxxxx calico-node-8wfpvxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running kube-multus 3 xxxxxxxxxxxxx kube-multus-ds-l6pgfxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running liveness-probe 3 xxxxxxxxxxxxx vsphere-csi-node-rk6zlxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running vsphere-csi-node 12372 xxxxxxxxxxxxx vsphere-csi-node-rk6zlc46edf15xxxxx xxxxxxxxxxxxx 2 months ago Running node-driver-registrar 4 xxxxxxxxxxxxx vsphere-csi-node-rk6zlxxxxxxxxxxxxx xxxxxxxxxxxxx 2 months ago Running kube-proxy 3 xxxxxxxxxxxxx kube-proxy-mlp9w
3. Next, identify the container ID for the pod that is not receiving traffic, and retrieve the container’s PID by running the following command:
# CONTAINER_PID=$(sudo crictl inspect --output go-template --template '{{.info.pid}}' c46edf15xxxxx)
# echo $CONTAINER_PID1471
4. Once you have the CONTAINER_PID you can capture the traffic on the node for the container/pod using the nsenter command
sudo nsenter -t $CONTAINER_PID -n tcpdump -i eth0 -w traffic_capture.pcap