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:
Which tells us which to look at. In my case, I can confirm using:
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:
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
And so the complete command is:
ssh -i ~/.minishift/machines/minishift/id_rsa email@example.com