kubectl-debug enables seamless debugging of running Kubernetes pods by injecting a new container sharing namespaces with the target pod without modifying the original container image.
This repository is no longer maintained, please checkout https://github.com/JamesTGrant/kubectl-debug.
This tool is primarily used by Kubernetes administrators and developers to troubleshoot and debug live pods in a cluster without needing to pre-install debugging tools inside the production containers. It facilitates incident response and security automation by allowing quick access to pod internals using a separate debug container.
This repository is deprecated and no longer maintained; users are advised to switch to https://github.com/JamesTGrant/kubectl-debug. The tool requires Kubernetes cluster access with appropriate permissions to create debug containers and optionally deploy DaemonSets. Agentless mode is enabled by default for convenience but may have slower startup times compared to using a pre-installed debug agent DaemonSet.
Install via Homebrew: brew install aylei/tap/kubectl-debug
Download binary for Linux x86_64: curl -Lo kubectl-debug.tar.gz https://github.com/aylei/kubectl-debug/releases/download/v0.1.1/kubectl-debug_0.1.1_linux_amd64.tar.gz
Download binary for macOS: curl -Lo kubectl-debug.tar.gz https://github.com/aylei/kubectl-debug/releases/download/v0.1.1/kubectl-debug_0.1.1_darwin_amd64.tar.gz
Extract the binary: tar -zxvf kubectl-debug.tar.gz kubectl-debug
Move binary to system path: sudo mv kubectl-debug /usr/local/bin/
For Windows, download the latest release archive, decompress and add kubectl-debug to PATH
Optionally install debug agent DaemonSet for faster debug sessions: kubectl apply -f https://raw.githubusercontent.com/aylei/kubectl-debug/master/scripts/agent_daemonset.yml
For Kubernetes versions <1.16, modify apiVersion in agent_daemonset.yml before applying
Alternatively, install via Helm: helm install kubectl-debug -n=debug-agent ./contrib/helm/kubectl-debug
kubectl debug -h
Displays help information and usage instructions for kubectl-debug
kubectl debug --agentless=false POD_NAME
Starts a debug session using the pre-installed debug agent DaemonSet for faster startup