k3sup icon indicating copy to clipboard operation
k3sup copied to clipboard

Leverage SSH Config

Open bashfulrobot opened this issue 4 years ago • 3 comments

Hi there,

This is more of a question than an issue (so this can be closed upon reply).

My target VM's are behind a NAT that provide SSH access via a JumpProxy directive (jump host) in an ssh config file.

IE

Host srv
    HostName 10.0.0.10
    User dustin
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_rsa

Host k8c
    HostName 192.168.122.22
    ProxyJump srv
    User dustin
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_rsa

Is there a way to leverage the jump host with k3sup?

Thank you very much for your time.

bashfulrobot avatar Jan 27 '21 07:01 bashfulrobot

I think I have a related question. Vagrant also provides a custom ssh config vagrant ssh-config to ssh into the VMs.

Host node1
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /foo/.vagrant/machines/node1/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

Host node2
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /foo/.vagrant/machines/node2/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

But I am unsure how to leverage the ssh config with k3ups. Does it even take into account the ssh config at all?

tcurdt avatar Feb 06 '21 17:02 tcurdt

Hello! This would be really helpful for provisioning on machines behind nat. any hope to get this soon? @alexellis Thanks for the great util!

ilgarm avatar Mar 10 '21 22:03 ilgarm

I'm having the same experience with hashi-up, but there is actually a workaround to install k3s with k3sup on targets behind a jump host.

I'm sure the ssh client will use your SSH config, so you should be able to create a connection with local port forwarding, eg:

My SSH config:

Host 192.168.5.101
  ProxyJump [email protected]

First bring the SSH service of the target to your local machine:

ssh -L 2222:localhost:22 [email protected]

Now you can install k3s with k3sup, using the local port:

k3sup install --host localhost --ssh-port 2222 ...

jsiebens avatar May 15 '21 08:05 jsiebens

Please use the solution proposed by @jsiebens

alexellis avatar Aug 26 '22 10:08 alexellis

/lock

alexellis avatar Aug 26 '22 10:08 alexellis

/set title: Installation via bastion host

alexellis avatar Aug 29 '22 14:08 alexellis