snapshot_socket
The snapshot_socket
shows existing sockets.
Getting started
Running the gadget:
- kubectl gadget
- ig
$ kubectl gadget run ghcr.io/inspektor-gadget/gadget/snapshot_socket:latest [flags]
$ sudo ig run ghcr.io/inspektor-gadget/gadget/snapshot_socket:latest [flags]
Guide
Run a pod / container:
- kubectl gadget
- ig
$ kubectl run --restart=Never --image=nginx test-snapshot-socket
pod/test-snapshot-socket created
$ docker run --name test-snapshot-socket -d nginx
...
Then, run the gadget and see how it shows the sockets used by nginx:
- kubectl gadget
- ig
$ kubectl gadget run snapshot_socket:latest
K8S.NODE K8S.NAMESPACE K8S.PODNAME K8S.CONTAINERNAME SRC DST STATE
minikube-docker default test-snapshot-socket test-snapshot-socket :::80 :::0 10
minikube-docker default test-snapshot-socket test-snapshot-socket 0.0.0.0:80 0.0.0.0:0 10
^C
$ sudo ig run snapshot_socket:latest -c test-snapshot-socket
RUNTIME.CONTAINERNAME SRC DST STATE
test-snapshot-socket :::80 :::0 10
test-snapshot-socket 0.0.0.0:80 0.0.0.0:0 10
^C
Finally, clean the system:
- kubectl gadget
- ig
$ kubectl delete pod test-snapshot-socket
$ docker rm -f test-snapshot-socket