I’m testing out a custom node driver and am running into an issue where I don’t know how to pass an SSH key to my driver. The custom node driver accepts either a path to a SSH key or the fingerprint of a SSH key that is loaded in the SSH agent. I’m able to set either of these parameters in my node template via the Rancher UI but I don’t know how to get my node driver access to this SSH key.
I’m running rancher in a docker container on an Ubuntu VM. I tried copying my SSH key inside the rancher docker container. When I exec
into the rancher docker container I can see my SSH key but the node driver still can’t access the key because rancher creates a jail when running the node driver and the jail doesn’t contain the key.
I also tried adding the SSH key to the SSH agent in the Ubuntu VM that hosts the rancher docker container and recreated the rancher docker container with the following arguments:
-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK
This allows me to see the SSH key when I run ssh-add -l
from inside the rancher docker container and I can also echo $SSH_AUTH_SOCK
and see that it’s set but $SSH_AUTH_SOCK
is still not accessible to my node driver since it’s in a jail.
I’ve also tried setting ssh_agent_auth: true
with no luck.
Here’s where I see it creating a jail in the rancher docker container log:
2022/03/19 01:27:45 [INFO] Creating jail for c-9dfx6
2022/03/19 01:27:45 [INFO] Provisioning node k8s-worker-1
How can one go about giving the node driver jail access to a SSH key?