Run a debug pod on a node

Get a shell on a cluster node through a debug pod; the node filesystem is mounted at /host

kubectl debug node/my-node -it --image=ubuntu

tool
k8s-debug27 commands
tags
k8s-debugkubectl

More k8s-debug commands

  • kubectl exec -it mypod -c sidecar-name -- /bin/sh

    Open a shell in one container of a multi-container pod

  • kubectl get pod mypod -o jsonpath='{range .spec.containers[*]}{.name}{"\t"}{.resources}{"\n"}{end}'

    Show resource requests and limits for each container

  • kubectl describe node my-node | grep -A5 'Conditions:'

    Check the node conditions: Ready, MemoryPressure, DiskPressure

  • kubectl top pods -A --sort-by=memory | head -20

    Show the top 20 pods by memory usage

  • kubectl get events -n mynamespace --field-selector involvedObject.name=mypod --watch

    Stream events for one pod as they happen

all 27 k8s-debug commands