Test DNS inside the cluster

Resolve a Service FQDN from a temporary pod to tell CoreDNS problems from app DNS problems

kubectl run dnstest --rm -it --image=nicolaka/netshoot --restart=Never -- dig +short <name>.<ns>.svc.cluster.local

tool
k8s-debug27 commands
tags
k8s-debugdnsnetworktroubleshooting

More k8s-debug commands

  • kubectl events --for pod/<pod> -n <ns> --types=Warning

    Show only Warning events for one pod, in time order; the newer way instead of get events with filters

  • kubectl logs <pod> -n <ns> -c <name> --previous --timestamps --tail=200

    Show the last 200 lines of the previous container instance, with timestamps, to catch the stack trace before the restart

  • kubectl debug -it <pod> --image=nicolaka/netshoot -n <ns>

    Attach a netshoot debug container to a running pod; it shares the pod network namespace

  • kubectl top nodes

    Show CPU and memory for each node (needs metrics-server)

  • kubectl top pods -A --sort-by=memory

    Show pods in all namespaces sorted by memory, to find the hungriest ones

all 27 k8s-debug commands