#k3s not starting

1 messages Β· Page 1 of 1 (latest)

violet perch
#

Hi again, i'm trying to follow this guide to run k3s for my integration tests that are deployed via helm https://github.com/dagger/dagger/issues/5292
I know that i have to adjust the code to work with Container.asService but i'll get to that later. For now this basic snippet fails:

import sys
import anyio
import dagger

async def main():
    async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:

        out = (
            client.container()
            .from_("rancher/k3s")
            .with_entrypoint(["sh", "-c"])
            .with_exec(["k3s server --snapshotter native"], insecure_root_capabilities=True)
        )

        k3s = await out.stdout()

    print(k3s)

anyio.run(main)

Getting errors:

node_container_manager_linux.go:61] "Failed to create cgroup" err="cannot enter cgroupv2 \"/sys/fs/cgroup/kubepods\" with domain controllers -- it is in an invalid state" cgroupName=[kubepods]                                     
kubelet.go:1466] "Failed to start ContainerManager" err="cannot enter cgroupv2 \"/sys/fs/cgroup/kubepods\" with domain controllers -- it is in an invalid state"      

Using all the latest versions.

GitHub

What is the issue? Some users in discord (https://discord.com/channels/707636530424053791/1114570469958484008) have requested the ability to test kubernetes pipelines in Dagger. With the help of @v...

heavy shard
#

πŸ‘‹ what system are you currently running this on?

#

are you on linux? mac?

heavy shard
#

seems to be also happening with the latest version of the k3s image. Seems like something changed that that doesn't seem to be working with Insecure mode in buildkitl. Not sure if @teal perch might have a hint about what could be happening

#

doesn't seem to happen with docker run --privileged

teal perch
heavy shard
heavy shard
heavy shard
#

ok, found the issue, not sure why/how this was working before

#

seems like k3s performs cgroup nesting (same script the dind image uses) "only" when it's executed as pid 1. Since we have our shim that's currently preventing that, the cgroup evacuation doesn't happen an it fails when trying to setup the cgroups kubernetes

#

a workaround is to run the cgroup nesting entrypoint oursleves. Will share a snippet in a bit cc @teal perch

heavy shard
novel charm
#

(not that i have any crying_lemon)