- Yair Mark
On Minikube you can easily log in to the VM running the minikube cluster by running
minikube ssh. This command logs you in and lets you do what you need to do on the machine but makes it difficult to script commands you need run on minikube. The minikube help for the ssh command does say you can execute commands using that flag but does not give any examples and a quick Google did not turn up any answers either.
I know that with ssh if you add double dash
-- after the connection details and specify a command then that command is run on the target server. For example
ssh [email protected] -- touch someFile.txt will create someFile.txt on someHost after logging in using someUser's credentials and exit the remote host. The double dashes tell the ssh command that there are no more command line options and it must not parse what is after the dashes but rather pass that command to the remote server to execute. So I tried this with
minikube ssh and achieved a similar result! Running the following will run a directory listing on the home directory in minikube:
minikube ssh -- ls -al