The "network-graph" gadget

    The network-graph gadget monitors the network activity in the specified pods and records the list of TCP connections and UDP streams.

    On Kubernetes

    • Start the gadget:
    $ kubectl gadget trace network -n demo
    • Generate some network traffic:
    $ kubectl run -ti -n demo --image=busybox --restart=Never shell -- wget
    • Observe the results:
    NODE             NAMESPACE        POD                            TYPE      PROTO  PORT    REMOTE
    minikube         demo             shell                          OUTGOING  udp    53      svc kube-system/kube-dns
    minikube         demo             shell                          OUTGOING  tcp    80      endpoint

    With local-gadget

    • Start local-gadget:
    $ sudo ./local-gadget --runtimes=docker
    » create network-graph trace1 --container-selector demo
    State: Started
    » stream trace1 -f
    • Generate some network traffic:
    > $ docker run --name demo -ti --rm busybox
    > / # for i in `seq 5` ; do wget ; done
    • Observe the results:
    {"type":"debug","message":"tracer attached","node":"local","namespace":"default","pod":"demo"}