-
Hi! I'm trying to prepare a set of VMs with k3s, and have everything that I need to (later) allow a user to login and setup rootless. With the current suggested workflow, namely calling the install script in one of two ways: # For the control plane
curl -sfL https://get.k3s.io | K3S_TOKEN=${secret_token} sh -
# For an agent
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=testing K3S_URL=https://${login_node}:6443 K3S_TOKEN=${secret_token} sh - This assumes that I can get sudo, so I can't have this be done by a user. So I've been trying to piece apart the logic of that script to separate the two needs (root vs user run) and I found both of these:
And that seems to successfully install the binaries, but then when I need to generate the kubeconfig for the user, e.g.,
that file isn't there. I could have the full startup script with some extra envars in the boot script, but we don't actually have hostnames yet and it's run for both control plane / agent nodes, so I can't be specific to choose which one to run. So I want to ask (and hopefully this is an easy answer!) how do I install this in a way that I can achieve the above - having the binaries / configs mostly ready to go on a system (prepared by root) and then a user just needs to setup their rootless service? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
Are you really talking about using k3s rootless, or are you just talking about installing and running k3s normally (as root, via a normal systemd service) and allowing users to access it without any additional privilege? I will note that if you give a non-root user admin access to Kubernetes you might as well just give them root as well; they can fully escalate to root by creating privileged pods that mount the host filesystem. |
Beta Was this translation helpful? Give feedback.
Rootless K3s runs fully isolated with its own pid/user/network namespaces. All instances of rootless k3s will use the same node IP for the user network namespace by default, although this can be overridden with the
K3S_ROOTLESS_CIDR
environment variable. Slirp4netns handles routing traffic between the actual host network namespace, and the user network namespace. It also handles mapping unprivileged ports on the host to privileged ports in the user network namespace.The current unsolved challenges probably mostly revolve around how to get the Flannel CNI working through the port mapping; at the moment there is no way to tell either k3s or flannel to communicate with the peer using the 10…