Debug pod with ephemeral container

Attach an ephemeral debug container to a running pod

kubectl debug -it mypod --image=busybox --target=app

tool
k8s-debug27 commands
tags
k8s-debugkubectl

More k8s-debug commands

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

    Get privileged shell on a cluster node via debug pod

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

    Open shell in a specific 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 node conditions: Ready, MemoryPressure, DiskPressure

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

    Top 20 pods sorted by memory consumption

all 27 k8s-debug commands