Skip to content

Instantly share code, notes, and snippets.

@jmound
Forked from coryodaniel/debug-containers.md
Created October 4, 2019 17:07
Show Gist options
  • Save jmound/8d567f9bd015f8df8f6b1fb3dc5be4ba to your computer and use it in GitHub Desktop.
Save jmound/8d567f9bd015f8df8f6b1fb3dc5be4ba to your computer and use it in GitHub Desktop.
Connect to a failing kubernetes pod to inspect mounts, etc

Update the command/args:

command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]

Run a command

kubectl exec my-pod -c my-container -- ls /

Get a shell:

kubectl exec -it shell-demo -- /bin/sh

Using an initContainer:

  initContainers:
  - name: debug
    image: busybox:1.28
    command: ['sh', '-c', 'echo initContainer! && sleep 3600']
kubectl exec -it my-pod -c debug -- bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment