OnCallReady

Commands

kubectl attach - Attach to a running container

kubectl attach (POD | TYPE/NAME) [-c CONTAINER] [-i] [-t] [--pod-running-timeout=1m0s]

Options you will use

-c, --container=NAME
which container
-i, --stdin
pass stdin to the container (it must have been started with stdin: true)
-t, --tty
stdin is a TTY (the container must have tty: true)
-q, --quiet
only print output from the remote session
--pod-running-timeout=1m0s
how long to wait for the pod to be running

Examples

$ kubectl attach web-5d8c

the main process's stdout/stderr from now on (Ctrl+C detaches)

$ kubectl attach shell -c shell -i -t

back into a kubectl run -it shell after you detached

Gotchas

Try kubectl attach in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.