Using trace dns

    The trace dns gadget prints information about DNS requests performed by the different pods.

    Create a demo namespace:

    $ kubectl create ns demo
    namespace/demo created
    

    Start the dns gadget:

    $ kubectl gadget trace dns -n demo
    POD                            TYPE      QTYPE     NAME
    

    Run a pod on a different terminal and perform some DNS requests:

    $ kubectl -n demo run mypod -it --image=wbitt/network-multitool -- /bin/sh
    # nslookup www.microsoft.com
    # nslookup www.google.com
    # nslookup www.amazon.com
    

    The requests will be logged by the DNS gadget:

    POD                            TYPE      QTYPE     NAME
    mypod                          OUTGOING  A         microsoft.com.demo.svc.cluster.local.
    mypod                          OUTGOING  A         microsoft.com.svc.cluster.local.
    mypod                          OUTGOING  A         microsoft.com.cluster.local.
    mypod                          OUTGOING  A         microsoft.com.
    mypod                          OUTGOING  AAAA      microsoft.com.
    mypod                          OUTGOING  A         www.google.com.demo.svc.cluster.local.
    mypod                          OUTGOING  A         www.google.com.svc.cluster.local.
    mypod                          OUTGOING  A         www.google.com.cluster.local.
    mypod                          OUTGOING  A         www.google.com.
    mypod                          OUTGOING  AAAA      www.google.com.
    mypod                          OUTGOING  A         www.amazon.com.demo.svc.cluster.local.
    mypod                          OUTGOING  A         www.amazon.com.svc.cluster.local.
    mypod                          OUTGOING  A         www.amazon.com.cluster.local.
    mypod                          OUTGOING  A         www.amazon.com.
    mypod                          OUTGOING  AAAA      e15316.a.akamaiedge.net.
    

    Delete the demo test namespace:

    $ kubectl delete ns demo
    namespace "demo" deleted