Preview:
# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.

kubectl exec <pod-name> -- date



# Get output from running 'date' in container <container-name> of pod <pod-name>.

kubectl exec <pod-name> -c <container-name> -- date



# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.

kubectl exec -ti <pod-name> -- /bin/bash
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter