Ephemeral debug copy with shared PIDs

Clone pod with a debug container sharing the PID namespace; original stays untouched

kubectl debug <pod> -n <ns> --copy-to=<pod>-dbg --share-processes --image=nicolaka/netshoot -- sleep infinity

tool
kubectl73 commands
tags
kubectldebugtroubleshootingk8s

More kubectl commands

  • kubectl explain deploy.spec --recursive | less

    Dump the full nested field tree of a resource spec; great for hunting valid fields

  • kubectl rollout pause deploy/<name> -n <ns>; kubectl rollout resume deploy/<name> -n <ns>

    Batch multiple edits without triggering rollouts, then resume to apply once

  • kubectl apply view-last-applied deploy/<name> -n <ns> -o yaml

    Show the last-applied-configuration annotation; diff intent vs live state

  • kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp

    Cluster-wide Warning events newest last; fast triage of failing workloads

  • kubectl get pods -A --field-selector status.phase=Failed

    List pods in Failed phase across namespaces for cleanup or investigation

all 73 kubectl commands