Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Last active November 7, 2023 09:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coryodaniel/ed6149080101909e46572fdf77c667ab to your computer and use it in GitHub Desktop.
Save coryodaniel/ed6149080101909e46572fdf77c667ab 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