gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

SSH access to preview-environments does not work any more

Open fullmetalrooster opened this issue 4 years ago • 15 comments

Bug description

I have rebase my branch the latest commit from main and I am no longer able to login to newly created VMs with SSH over port 22.

Steps to reproduce

You need to open a new workspace with the branch from this PR. After the VM is up and running you should be able to connect to the VM using the script ./dev/preview/ssh-vm.sh. It will create a SSH connection using a port-forwarding to port 22 over port 8022 on the workspace. Everything will be set up but the connection stops at the login. Removing the Gitpod installation from the werft job .werft/build.ts will work as expected.

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

No response

fullmetalrooster avatar Jan 24 '22 15:01 fullmetalrooster

@iQQBot Do you know why that might happen?

fullmetalrooster avatar Jan 24 '22 15:01 fullmetalrooster

https://gitpodio-gitpod-dqhr5o84510.ws.wth-automate-vm-ssh-access.preview.gitpod-dev.com/

stuck in Pulling container image …

iQQBot avatar Jan 24 '22 16:01 iQQBot

can you share how to connect into this vm's kubernetes ?

iQQBot avatar Jan 24 '22 17:01 iQQBot

@wulfthimm Hi, this is because we add SSH tcp tunnel in proxy https://github.com/gitpod-io/gitpod/pull/7607

There is some way to resolve this issue

  1. If the preview environment don't want to support ssh gateway (because is lack public ip) you can simple rebase to main again, and don't configuration hostkey because I already fixes it by https://github.com/gitpod-io/gitpod/pull/7731
  2. If the preview environment want to support ssh gateway (using tailscale / self-hosted-vpn / gcp loadbalancer to harvester) you may need change vm ssh port to another port

If you need more information please ping me

iQQBot avatar Jan 25 '22 04:01 iQQBot

can you share how to connect into this vm's kubernetes ?

You can ssh into the machine using the script ./dev/preview/ssh-vm-sh.

fullmetalrooster avatar Jan 25 '22 07:01 fullmetalrooster

  1. If the preview environment don't want to support ssh gateway (because is lack public ip) you can simple rebase to main again, and don't configuration hostkey because I already fixes it by Not exposing port 22 if not configured ssh gateway hostkey #7731

I will rebase again. Many thanks, @iQQBot !

fullmetalrooster avatar Jan 25 '22 07:01 fullmetalrooster

This is still happening unfortunately :/

I've noticed that SSH works if the VM has just been spun up, following SSH attempts always fail for some reason

ArthurSens avatar Jan 25 '22 12:01 ArthurSens

can you give me some information, such as your namespace name

iQQBot avatar Jan 25 '22 13:01 iQQBot

Yeah sure thing 🙂 image

This translates to preview-as-vm-monitoring namespace inside the harvester cluster

ArthurSens avatar Jan 25 '22 13:01 ArthurSens

and don't configuration hostkey

iQQBot avatar Jan 25 '22 13:01 iQQBot

I looked your configuare ssh host key, so that proxy is add 22 port to loadbalancer

iQQBot avatar Jan 25 '22 13:01 iQQBot

Sorry, I'm not sure if I understood 😬

Are we both talking about preview environments on Harvester cluster? I believe we use port-foward inside the workspace instead of load balancers, right?

ArthurSens avatar Jan 25 '22 13:01 ArthurSens

Yes we talk same problem, the loadbalencar I mean is k3s loadbalancer

You can use kubectl get svc proxy -o yaml to see it

iQQBot avatar Jan 25 '22 13:01 iQQBot

You can change the vm-ssh port to 2200 like https://github.com/gitpod-io/gitpod/commit/6926c575f4485b4275cb151eeba0320c23347905 do

iQQBot avatar Jan 26 '22 03:01 iQQBot

I believe this was fixed some days ago :)

ArthurSens avatar Feb 01 '22 17:02 ArthurSens