Easy way to capture tcpdump in kubernetes

kubectl krew install sniff

kubectl sniff “pod-name” -n “namespace” -c “container-name” -i “interface: -f “wireshark filter” -o “output_file_name.pcap”

kubectl sniff -p -o By adding the -p (priviledged) flag will be created a new Pod in namespace

kubectl sniff azure-ip-masq-agent-t2bw9 -f “port 80” -o — | tshark -r —

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store