How to run a single one-time command on a kubernetes instance/pod
A little more information is needed about specific operations you are doing, but generally your options are:

For one-time operations: use kubectl exec to get into containers and do commands (works similar to docker exec).

Also for one-time operations, spawn separate pods with shell access to interact with existing pods, something along the lines:


kubectl run -it --rm --restart=Never --image busybox tempbusybox -- sh


For reproducible (not one-time) operations, you may use kubernetes jobs.

In some cases you may use init containers for setup tasks.