gitpod-io / template-k3s

The k3s template, configured for Gitpod (www.gitpod.io) to give you pre-built, ephemeral Kubernetes development environments in the cloud.
MIT License
38 stars 16 forks source link

Fix: template-k3s is not working as-is (multiple issues) #3

Closed zwindler closed 2 years ago

zwindler commented 2 years ago

Description

template-k3s is not working anymore. I tried to run it using the "open in gitpod" link in the README.md but the scripts were failing directly at start.

Unless I'm mistaken, there are 3 issues in current version.

First: when you launch the workspace, gitpod launches a ubuntu (focal) image on the github host, then tries to install a bunch of stuff in init phase of the .gitpod.yml file, including the linux-image-$(uname -r).

Unfortunately, gitpod host now seems to run some custom linux-image-5.16.20-051620-generic which is not available in repos from /etc/apt/sources.list. You could install packages directly from kernel-ppa but that seems tedious to automate in the script, for future versions.

So I went for the workaround proposed in #1 issue, I installed linux-image-generic instead, which seems to be "ok", even though it's probably not really clean.

Second: the .gitpod/prepare-rootfs.sh script fails at line 17 (tar) because the hirsute image is not available anymore (404)!

I switched all references to this images to jammy, which should be around for some time since it's an LTS

Third: qemu, nc and kernel modules are installed during prebuild only. BUT:

Prebuilds save only the workspace directory. Other directories like the home directory are not saved by prebuilds.

That's an issue, because we also need qemu and kernel modules for script (command statement) .gitpod\[qemu.sh](http://qemu.sh/), and nc for .gitpod/prepare-k3s.sh

I add to re-install them in appropriate order

Related Issue(s)

Probably Fixes #1 as well

How to test

Open my repository in gitpod with these fixes

Release Notes

fixes linux-image missing package
fixes hirsute-server-cloudimg no longer available
fixes missing packages needed for scripts in "command" step

Documentation

sagor999 commented 2 years ago

@zwindler thank you for PR!! :heart:

Couple of notes: I see this in terminal for prepare k3s: .gitpod/prepare-k3s.sh: line 14: nc: command not found can you fix it?

Tried to launch ssh.sh but getting: ./ssh.sh: line 3: sshpass: command not found

Not sure if related to your PR or if it was broken prior as well. :thinking:

zwindler commented 2 years ago

Thanks for the review :-)

I know how to fix the nc not found. I had trouble with the fact that both terminal launch apt install at the same time, one of them failing because the other was locking. I'll add a little loop to deal with this properly.

I'll check the sshpass because I don't know yet what's the issue.

zwindler commented 2 years ago

@sagor999 can you check again with my latest modifications if that's better?