Kubernetes

Connect to a Kubernetes Pod

Published on

To open a session it’s first required to know the Pod’s name. kubectl get pod -n <namespace> Then open a bash session by running: kubectl exec --stdin --tty <pod name> -n <namespace> -- /bin/bash It’s also possible to open a shell session: kubectl exec --stdin --tty <pod name> -n <namespace> -- /bin/sh Sometimes it’s need to spawn a new Pod from an image that has the required tooling to inspect something.