OCI image for debugging Kubernetes pods.
kubectl debug -it --image=ghcr.io/mycreepy/kube-debug:latest --profile=restricted --namespace=[NAMESPACE] --target=[CONTAINER] [POD]Find your k9s plugins location:
k9s infoAdd to your plugins.yaml file:
plugins:
debug:
shortCut: Shift-D
description: Debug
scopes:
- containers
command: bash
background: false
args:
- -c
- 'kubectl debug -it --image=ghcr.io/mycreepy/kube-debug:latest --profile=restricted --context=$CONTEXT --namespace=$NAMESPACE --target=$NAME $POD'Interactive selection of namespace, pod, and container using fzf:
alias kdebug='NAMESPACE=$(kubectl get namespaces -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | fzf --prompt="Select namespace: ") && POD=$(kubectl get pods -n "$NAMESPACE" -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | fzf --prompt="Select pod: ") && CONTAINER=$(kubectl get pod "$POD" -n "$NAMESPACE" -o jsonpath="{.spec.containers[*].name}" | tr " " "\n" | fzf --prompt="Select container: ") && kubectl debug -it --image=ghcr.io/mycreepy/kube-debug:latest --profile=restricted --namespace="$NAMESPACE" --target="$CONTAINER" "$POD"'Windows:
winget install fzfLinux/macOS:
brew install fzfor
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install