Show pod events in order

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

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

tool
k8s-debug27 commands
tags
k8s-debugtroubleshootingobservabilityk8s

More k8s-debug commands

  • 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

  • kubectl get cm <name> -n <ns> -o jsonpath='{.data}'

    Print only the data field; pipe it to python -m json.tool for readable output

all 27 k8s-debug commands