What is minishift ssh anyway?

The documentation says that to access a minishift-deployed VM you can use `minishift ssh` to log in, but what if you want to use other tooling (like Ansible) to get in there? How can you use standard ssh commands to connect?

First, we need to find the IP address for the host machine. Since the oc commands work, we know that openshift, and thus kubernetes, can find the machine based on configuration. Looking in ~/.kube/config We see the set of server machines with stanzas like this

- context:
 cluster: 192-168-42-239:8443
 namespace: myproject
 user: system:admin/192-168-42-239:8443
 name: myproject/192-168-42-239:8443/system:admin

 

And the current context is set as:

current-context: myproject/192-168-42-239:8443/system:admin

Which tells us which to look at.  In my case, I can confirm using:

ping 192.168.42.239

which gives me:

PING 192.168.42.239 (192.168.42.239) 56(84) bytes of data.
64 bytes from 192.168.42.239: icmp_seq=1 ttl=64 time=0.355 ms

So I know that is an active VM.

If I run the minishift ssh command, I get logged in to the vm, and I see that it is as the docker user.  So I know I am going to want to run a command like:

ssh  docker@192.168.42.239

But that prompts me for my password, so it is not using the correct pkey.

Turns out that minishift sticks the openssl generated files in

~/.minishift/machines/minishift/

And so the complete command is:

ssh -i ~/.minishift/machines/minishift/id_rsa docker@192.168.42.23

Leave a Reply

Your email address will not be published. Required fields are marked *