Skip to content

mycrEEpy/kube-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kube-debug

OCI image for debugging Kubernetes pods.

Usage

kubectl

kubectl debug -it --image=ghcr.io/mycreepy/kube-debug:latest --profile=restricted --namespace=[NAMESPACE] --target=[CONTAINER] [POD]

k9s

Find your k9s plugins location:

k9s info

Add 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'

fzf alias

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"'

Installing fzf

Windows:

winget install fzf

Linux/macOS:

brew install fzf

or

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

About

OCI image for debugging Kubernetes pods.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors