How to ssh into rancher desktop node?
Asked Answered
H

3

7

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.

Handmaiden answered 29/4, 2022 at 9:15 Comment(0)
M
11

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.

Myxoma answered 21/9, 2022 at 18:28 Comment(1)
finally, nice and clean command.Handmaiden
U
4

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

Unionist answered 16/5, 2022 at 18:36 Comment(0)
A
3

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.

Anticlerical answered 8/6, 2022 at 7:27 Comment(2)
limactl list doesn't appear to work as the config is located in a different directory as the other answer suggests.Benedictine
Another option to use the default ssh key is to add the default public key to the file: /home/$USER.linux/.ssh/authorized_keys' once inside the VM using rdctl shell.Governance

© 2022 - 2024 — McMap. All rights reserved.