Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ksnif with GKE (cos) capture with privileged (-p) option: Nothing get captured #183

Open
GregoireW opened this issue Jun 10, 2024 · 0 comments · May be fixed by #184
Open

ksnif with GKE (cos) capture with privileged (-p) option: Nothing get captured #183

GregoireW opened this issue Jun 10, 2024 · 0 comments · May be fixed by #184

Comments

@GregoireW
Copy link

When launching ksniff on a GKE cluster (1.28+) running COS node and with the '-p' to create a privileged port to sniff an existing pod, I got no output as the tcpdump fail:

+ export 'CONTAINERD_NAMESPACE=k8s.io'
+ export 'CONTAINER_RUNTIME_ENDPOINT=unix:///host/run/containerd/containerd.sock'
+ export 'IMAGE_SERVICE_ENDPOINT=unix:///host/run/containerd/containerd.sock'
+ crictl pull docker.io/maintained/tcpdump:latest
+ crictl inspect 123456789123456789123456789123456789123456789
+ jq '.info.runtimeSpec.linux.namespaces[] | select(.type == "network") | .path'
+ tr -d '"'
+ netns=/proc/12345678/ns/net
+ exec chroot /host ctr -a /run/containerd/containerd.sock run --rm --with-ns network:/proc/12345678/ns/net docker.io/maintained/tcpdump:latest ksniff-container-abcdef123456 tcpdump -i any -U -w -
time="2024-06-10T12:09:45Z" level=info msg="apply failure, attempting cleanup" error="failed to extract layer sha256:123456789123456789123456789123456789123456789123456789: failed to get reader from content store: content digest sha256:123456789123456789123456789123456789123456789123456789: not found" key="extract-123456789-aaaa sha256:123456789123456789123456789123456789123456789123456789"
ctr: failed to extract layer sha256:123456789123456789123456789123456789123456789123456789: failed to get reader from content store: content digest sha256:123456789123456789123456789123456789123456789123456789: not found
' 

Basically ctr do not find the tcpdump image.
Modifying the code to use ctr to pull the image do the trick and fix the issue.

@GregoireW GregoireW linked a pull request Jun 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant