Capturing a network trace in a pod
Procedure
-
Get the name of the pod.
kubectl get pods
-
Start a shell session in the pod. Issue the below command, and make the
following substitutions:
kubectl exec -it <podname> --container=<container name> -- bash
- podname
- The name of the pod.
- container_name
- is the name of the container. If the pod only has one container you can omit this parameter.
For example, if the pod name is jitsi-74d95d6d49-k5nts and the container name is jigasi, then the resulting command is:kubectl exec -it jitsi-74d95d6d49-k5nts --container=jigasi --bash
-
Update the repositories by issuing the below command:
apt-get update
-
Install tcpdump by issuing the below command:
apt-get install tcpdump
-
Capture the network data, by issuing the command:
tcpdump -i any -w <filename>.pcap
- Reproduce the problem.
- To stop and save the capture press Ctrl+C.