Quick interactive testing

If you are trying to make a quick one-liner initialization container, it's often useful to try out a command interactively, especially if you're using a very minimal container such as busybox. The commands you want may not be available, so it's best to try it out quickly to verify it can work as you expect.

To run a busybox container interactively, and delete it all when it's complete, you can use a command such as the following:

kubectl run tempinteractive -it --rm --restart=Never --image=busybox -- /bin/sh

And then try out this command within the container:

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.