How to ssh into rancher desktop node?

3.8k views Asked by At

I just started to use Rancher and request to correct me for any wrong terminology.

Earlier I was using minikube on Macbook which provide SSH easily using minikube ssh for troubleshooting. As I am newbie to Rancher Desktop and wanted to do SSH on Rancher Desktop node similar to minikube.

I googled for same but unfortunately I didn't get any fruitful answer. Thanks in advance.

3

There are 3 answers

1
Eric On BEST ANSWER

On recent versions (1.3 on) you can use the rdctl utility, which ships with Rancher Desktop, and run rdctl shell COMMAND or rdctl shell to ssh into the VM.

0
Kuldeep On

You can access using below(first line):

$LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0

lima-rancher-desktop:/Users/kulsharm2$ uname -a Linux lima-rancher-desktop 5.10.103-0-virt #1-Alpine SMP Tue, 08 Mar 2022 10:06:11 +0000 x86_64 Linux

2
user2987504 On

you should be able to use limactl show-ssh NAME where NAME is the name of your rancher node (which you can list using limactl list).

alternatively, you can also use ps -ef | grep rancher which will list the rancher processes, some of which containing ssh information:

126693404  2136  1983   0 Thu12PM ??         0:00.01 ssh -F /dev/null -o IdentityFile="/Users/xxxxxx/Library/Application Support/rancher-desktop/lima/_config/user" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o NoHostAuthenticationForLocalhost=yes -o GSSAPIAuthentication=no -o PreferredAuthentications=publickey -o Compression=no -o BatchMode=yes -o IdentitiesOnly=yes -o Ciphers="^[email protected],[email protected]" -o User=xxxxxx -o ControlMaster=auto -o ControlPath="/Users/xxxxxx/Library/Application Support/rancher-desktop/lima/0/ssh.sock" -o ControlPersist=5m -p 49314 127.0.0.1 -- sshfs :/tmp/rancher-desktop /tmp/rancher-desktop -o slave -o allow_other

you can then manually ssh by using the same port and identity file as the command is using. In this case:

 ssh -p 49314 -i '/Users/xxxxxx/Library/Application Support/rancher-desktop/lima/_config/user' xxxxxx@localhost

This is, for sure, less convenient but seems to be working well.