Rancher CLI fails to find SSH keys

I’ve downloaded the rancher CLI. I’m running it inside a container, and have mounted my SSH keys inside the container.

I’m trying to create a new host at Amazon. When I run the CLI rancher host create command, it finishes happily, spitting out what I presume is an ID for the node. When I go to Rancher, I see a message:

“Error in driver during machine creation: unable to create key pair: open /id_rsa: no such file or directory”.

The id_rsa and id_rsa.pub files are both available in the root of the container.

I’ve used the same technique to run docker-machine, which worked fine.

Is this a bug in the CLI, or am I missing something?

Upayavira

I’ve worked out what is going wrong. On the CLI command “rancher host create” you provide a parameter --amazonec2-ssh-keypath. Contrary to expectations, this is NOT the path within my local host. It isn’t the path on the Rancher server either, but rather the path INSIDE the rancher server container.

Once I uploaded my public and private SSH keys into the Rancher server container and reran the “rancher host create” command, it worked as expected (or at least - moved on to the next issue!)

As a user, I would expect --amazonec2-ssh-keypath to refer to a directory on my local workstation.

I created a ticket: https://github.com/rancher/rancher/issues/5597

1 Like