0

I see this command to temporarily run a pod

k run -it pod1 --image=cosmintitei/bash-curl --restart=Never --rm

What does -it mean here ?

I don't know about the -it being used here. Why is it being used? What else can it be used for?

ShadowRanger
  • 143,180
  • 12
  • 188
  • 271
  • Given how closely Kubernetes hews to Docker, the related [what is docker run -it flag?](https://stackoverflow.com/q/48368411/364696) is a useful cross-link here. – ShadowRanger Nov 30 '22 at 18:09

1 Answers1

1

The -it a a short form of -i -t which in turn is a short form of --stdin --tty.

As such, this instructs kubernetes to

  • pass its STDIN to the started process
  • and to present STDIN as a TTY (i.e. a interactive terminal)
Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • Thanks @Holger. How would STDIN work without a TTY ? – ANKIT RAWAT Dec 05 '22 at 05:35
  • 1
    You can also pipe the output of a local command to a program running in the docker image, e.g. `echo "hello world" | k run -i pod1 ...`. In that case, you don't need a TTY. Some programs detect whether its STDIN is a tty and change their behavior based on that (to e.g. enable/disable support for interactive menus, use different defaults, ...) Check the respective program's documentation for details. – Holger Just Dec 05 '22 at 13:07