Kirk Bater

40 points
Hat, Face, Beard
Upstate NY

Kirk is a SRE at Red Hat working on Openshift Dedicated. He's a DevOps professional with over 10 years personal and professional experience ranging from graphic/web design and UI/UX, to front-end, to backend, to infrastructure and operations.

Authored Content

Authored Comments

Excellent article!

One (small) nit pick: the exec command isn't _only_ to open a shell, you can one-off execute any command that pod/container has access to. In your example you're just executing `/bin/bash` in order to poke around and run other commands, but if you have some other program installed or script installed you can call just that, instead.

So let's say you have a command that runs a specific ops task that you haven't fully automated yet, your command might be:

kubectl exec -it cherry-chart-88d49478c-dmcfv -n charts -- /etc/path/to/script.sh

Which would just run the /etc/path/to/script.sh, putting all stdin/stdout to your terminal, and then it would exit when it's complete, instead of leaving open the terminal within the container.