-1

I am trying to set up a container image for my CI which is supposed to serve all tools needed for the pipeline to run.

The idea is to use a podman image quay.io/podman/stable and install KIND and other dependencies. This image is then used by the pipeline agent to deploy services into the KIND cluster to run tests.

The issue is: When running kind create cluster inside the successfully built container I get this error message:

ERROR: failed to create cluster: running kind with rootless provider requires cgroup v2, > see https://kind.sigs.k8s.io/docs/user/rootless/

The provided link does not give me any hints to solve my problem in a container.

My dockerfile looks like this:

FROM quay.io/podman/stable:latest

RUN yum update -y && yum install -y golang openssl

RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
RUN install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

RUN go install sigs.k8s.io/kind@v0.20.0 && \
    cp /root/go/bin/kind /bin/kind
RUN install -o root -g root -m 0755 /root/go/bin/kind /usr/local/bin/kind

I don't really know where I should start looking for issues. Reading the podman documentation didn't help much.

Did anyone come across this issue and can help me out here?

Thanks in advance!

Daniel

P.S.: You might ask yourself why I do not use docker for this. The reason is, especially for gitlab pipelines the docker daemon is a hastle to work with. Thats why I wanted to work with podman, which works perfectly fine for "normal" scenarios like building an image or running a compose up.

Daniel
  • 71
  • 5

1 Answers1

0

You should enable ControlGroup v2.

Following the official documentation https://kubernetes.io/docs/concepts/architecture/cgroups/, if your system uses GRUB, you should add the parameter systemd.unified_cgroup_hierarchy=1 in the GRUB_CMDLINE_LINUX under /etc/default/grub. Depending to your OS distribution you can set it with:

sudo sed -i -e 's/^GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=1"/' /etc/default/grub
sudo update-grub
Alez
  • 1,913
  • 3
  • 18
  • 22
  • Unfortunately this does not work inside the host container which runs KIND there simply is no grub available. All the examples expect you to run KIND on an actual host which I do not have. Due to the nature of containerized pipelines from Bitbucket und Gitlab I need to run it in a container. – Daniel Aug 14 '23 at 04:16