k0sproject / k0s

k0s - The Zero Friction Kubernetes
https://docs.k0sproject.io
Other
3.42k stars 353 forks source link

Install k0s fails when nologin binary is missing #1184

Closed prabirshrestha closed 2 years ago

prabirshrestha commented 2 years ago

Version

$ k0s version
v1.22.2+k0s.1

Platform Which platform did you run k0s on? Synology NAS - DSM 7

What happened? Installation fails when running sudo k0s install controller --single.

How To Reproduce How can we reproduce this issue? (as minimally and as precisely as possible) Try installing in an OS that doesn't ship nologin binaries such as Synology NAS - DSM 7.

Expected behavior A clear and concise description of what you expected to happen.

Should be able to install.

Screenshots & Logs If applicable, add screenshots to help explain your problem. Also add any output from kubectl if applicable:

$ sudo k0s install controller --single
Password:
INFO[2021-10-10 09:42:34] no config file given, using defaults
Error: failed to create controller users: exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH
2021/10/10 09:42:34 failed to create controller users: exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH
exec: "nologin": executable file not found in $PATH

Additional context Add any other context about the problem here.

prabirshrestha commented 2 years ago

seems like if I add an alias for nologin as false, it goes to the next step but both useradd and adduser doesn't exist on synology nas so it fails.

I have tried the rootless.

sudo mkdir /root/k0s
sudo chmod 755 /root/k0s
sudo k0s controller --single --data-dir /root/k0s

This seems to go pass but still get the following errors.

INFO[2021-10-10 19:54:07] E1010 19:54:07.567374   11690 kuberuntime_manager.go:815] "CreatePodSandbox for pod failed" err="rpc error:
code = Unknown desc = failed to create containerd task: failed to create shim: failed to mount rootfs component &{overlay overlay [workdir=/root/k0s/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/work upperdir=/root/k0s/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/fs lowerdir=/root/k0s/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/1/fs]}: no such device: unknown" pod="kube-system/kube-router-cvczq"  component=kubelet

Was able to successfully install k3s with default installation instructions on synology nas.

ksawerykarwacki commented 2 years ago

Looking at this problem I found a comment here: https://www.reddit.com/r/synology/comments/b1oscm/creating_users_and_groups_with_set_uidgid/

synology stores user and group data in Berkeley db files (in /run/synosdk) - the /etc files are (re)generated from these canonical sources, so modifying /etc/[passwd|group] won't do what you want.

So it requires more robust workaround to be truly no OS dependent rather than copy/paste missing binaries

prabirshrestha commented 2 years ago

Since I'm using data dir k0s will use the current user instead of creating a new one. Based on the logs I think we are already passed it. Issue seems to be related to overlay fs and BTRFS volumes. K3S seems to have similar issue https://github.com/k3s-io/k3s/issues/2755, https://github.com/k3s-io/k3s/issues/19.

trawler commented 2 years ago

Hey @prabirshrestha, thanks for submitting this. As far as I could find, Synology, while is a Linux operating system, is a heavily modified Linux distribution and is lacking many common libraries and binaries (as you discovered). While k0s core functionality may work, some of it's helper functions (like install) were never tested on all operating systems. You can still go ahead and create the users, directories and startup scripts manually, and run k0s that way.

kke commented 2 years ago

The nologin/user adding issues should be avoidable by creating the users manually. They are only created if they do not exist already. I think you can configure most if not all of them in installConfig.users, maybe you could run everything as root if you wish to live dangerously.

The k0s install is only tested on systemd and openrc, I'm not sure if it does anything on upstart or whatever init system synology is running.

If k0s runs on the device without installing (using k0s controller --etcetcetc), you can create start up scripts in the way the operating system / distro likes them.

Running unsupported software on odd devices is always going to require custom trickery, I don't think "hacked" NAS boxes are a top priority for development.