eldadru / ksniff

Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark
Apache License 2.0
3.18k stars 190 forks source link

Issues running on arm64 #168

Open Iker-Jimenez opened 1 year ago

Iker-Jimenez commented 1 year ago

Hi, when the pod I want to sniff on is running on an arm64 arch ksniff throws an error around the tcpdump image being used. See below:

❯ k sniff my-pod -p -n my-ns
INFO[0001] no container specified, taking first container we found in pod.
INFO[0001] selected container: 'my-container'
INFO[0001] sniffing method: privileged pod
INFO[0001] sniffing on pod: 'my-pod' [namespace: 'my-ns', container: 'my-container', filter: '', interface: 'any']
INFO[0001] creating privileged pod on node: 'my-node'
INFO[0002] pod: 'ksniff-t44bl' created successfully in namespace: 'my-ns'
INFO[0002] waiting for pod successful startup
INFO[0004] pod: 'ksniff-t44bl' created successfully on node: my-node'
INFO[0004] spawning wireshark!
INFO[0004] starting remote sniffing using privileged pod
INFO[0004] executing command: '[docker --host unix:///var/run/docker.sock run --rm --log-driver none --name=ksniff-container-EZrBhiKP --net=container:cb99a66ee87c911a0cb8784fae091cc339fd0a31c1446d38731062de1bcb97b2 maintained/tcpdump -i any -U -w - ]' on container: 'ksniff-privileged', pod: 'ksniff-t44bl', namespace: 'my-ns'
INFO[0005] command: '[docker --host unix:///var/run/docker.sock run --rm --log-driver none --name=ksniff-container-EZrBhiKP --net=container:cb99a66ee87c911a0cb8784fae091cc339fd0a31c1446d38731062de1bcb97b2 maintained/tcpdump -i any -U -w - ]' executing successfully exitCode: '125', stdErr :'Unable to find image 'maintained/tcpdump:latest' locally
latest: Pulling from maintained/tcpdump
Digest: sha256:3af57c88b41a1f6389307cc0ebc51ce2493fe1075b5f3c3092f758517a443990
Status: Image is up to date for maintained/tcpdump:latest
WARNING: image with reference maintained/tcpdump was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64
docker: Error response from daemon: image with reference maintained/tcpdump was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64.
See 'docker run --help'.
'
INFO[0005] remote sniffing using privileged pod completed

There seems to be just a linux/amd64 build of maintained/tcpdump

nefelim4ag commented 10 months ago
--image ghcr.io/nefelim4ag/ksniff-helper:v4 --tcpdump-image ghcr.io/nefelim4ag/tcpdump:latest

I believe that will help with arm

Personally, I of course prefer to have them on the official repo, and not scattered around by different contributors like now.