kubernetes-sigs / kind

Kubernetes IN Docker - local clusters for testing Kubernetes
https://kind.sigs.k8s.io/
Apache License 2.0
13.29k stars 1.54k forks source link

Running with rootless podman seems not to respect property Delegate=yes #2916

Closed plluksie closed 2 years ago

plluksie commented 2 years ago

What happened: I'm not able to create cluster.

What you expected to happen: I'm able to create cluster.

How to reproduce it (as minimally and precisely as possible):

❯ sudo cat /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=yes

❯ KIND_EXPERIMENTAL_PROVIDER=podman kind -v 5 create cluster
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
ERROR: failed to create cluster: running kind with rootless provider requires setting systemd property "Delegate=yes", see https://kind.sigs.k8s.io/docs/user/rootless/
Stack Trace: 
sigs.k8s.io/kind/pkg/errors.New
    sigs.k8s.io/kind/pkg/errors/errors.go:28
sigs.k8s.io/kind/pkg/cluster/internal/create.validateProvider
    sigs.k8s.io/kind/pkg/cluster/internal/create/create.go:253
sigs.k8s.io/kind/pkg/cluster/internal/create.Cluster
    sigs.k8s.io/kind/pkg/cluster/internal/create/create.go:70
sigs.k8s.io/kind/pkg/cluster.(*Provider).Create
    sigs.k8s.io/kind/pkg/cluster/provider.go:182
sigs.k8s.io/kind/pkg/cmd/kind/create/cluster.runE
    sigs.k8s.io/kind/pkg/cmd/kind/create/cluster/createcluster.go:80
sigs.k8s.io/kind/pkg/cmd/kind/create/cluster.NewCommand.func1
    sigs.k8s.io/kind/pkg/cmd/kind/create/cluster/createcluster.go:55
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/cobra@v1.4.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/cobra@v1.4.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/cobra@v1.4.0/command.go:902
sigs.k8s.io/kind/cmd/kind/app.Run
    sigs.k8s.io/kind/cmd/kind/app/main.go:53
sigs.k8s.io/kind/cmd/kind/app.Main
    sigs.k8s.io/kind/cmd/kind/app/main.go:35
main.main
    sigs.k8s.io/kind/main.go:25
runtime.main
    runtime/proc.go:250
runtime.goexit
    runtime/asm_amd64.s:1571

Following @cwrau recommendation expressed in https://github.com/kubernetes-sigs/kind/issues/2872#issuecomment-1210772774:

❯ KIND_EXPERIMENTAL_PROVIDER=podman systemd-run --user --property=Delegate=yes kind -v 5 create cluster
Running as unit: run-r28fa7c60a5144fdea8b349e1033c4370.service

❯ systemctl --user | grep run-r28fa7c60a5144fdea8b349e1033c4370.service
  ● run-r28fa7c60a5144fdea8b349e1033c4370.service     loaded failed     failed    /home/lsiemiradzki/.local/bin/kind -v 5 create cluster                            

❯ journalctl -u run-r28fa7c60a5144fdea8b349e1033c4370.service
-- Logs begin at Tue 2022-05-24 15:06:54 CEST, end at Thu 2022-09-08 10:03:16 CEST. --
-- No entries --

Anything else we need to know?: It was working fine 1 month ago. In the meantime there were some standard package upgrades and security updates. I cannot precisely state what exactly has changed. It is Ubuntu: ❯ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.5 LTS Release: 20.04 Codename: focal

Environment:

plluksie commented 2 years ago

Seems to be an issue with podman. It works with

❯ podman -v 
podman version 3.4.2

I'll check with podman project.

deftdawg commented 1 year ago

@plluksie I'm having the same issue with podman 4.3.1, did you get it resolved without downgrading or is there an issue in podman for it?

cloudguruab commented 1 year ago

@deftdawg you ever figure it out? I'm running podman 4.3.1 with the same issue

BenTheElder commented 1 year ago

Perhaps the systemd-run note https://kind.sigs.k8s.io/docs/user/rootless/#creating-a-kind-cluster-with-rootless-podman ?

deftdawg commented 1 year ago

@deftdawg you ever figure it out? I'm running podman 4.3.1 with the same issue

No, gave up and switched to running docker-rootless

cloudguruab commented 1 year ago

Ah, thanks for the update @BenTheElder & @deftdawg

sword-jin commented 8 months ago

I encounter the same problem:

❯ sudo cat /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=yes

> podman version

Client:       Podman Engine
Version:      5.0.0-dev
API Version:  5.0.0-dev
Go Version:   go1.21.1
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

❯ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --name test --config kind-config.yaml
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
ERROR: failed to create cluster: running kind with rootless provider requires setting systemd property "Delegate=yes", see https://kind.sigs.k8s.io/docs/user/rootless/
Overmorrow1501 commented 8 months ago

I encounter the same problem:

❯ sudo cat /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=yes

> podman version

Client:       Podman Engine
Version:      5.0.0-dev
API Version:  5.0.0-dev
Go Version:   go1.21.1
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

❯ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --name test --config kind-config.yaml
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
ERROR: failed to create cluster: running kind with rootless provider requires setting systemd property "Delegate=yes", see https://kind.sigs.k8s.io/docs/user/rootless/

I got the same problem

sword-jin commented 8 months ago

I encounter the same problem:

❯ sudo cat /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=yes

> podman version

Client:       Podman Engine
Version:      5.0.0-dev
API Version:  5.0.0-dev
Go Version:   go1.21.1
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64

❯ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --name test --config kind-config.yaml
using podman due to KIND_EXPERIMENTAL_PROVIDER
enabling experimental podman provider
ERROR: failed to create cluster: running kind with rootless provider requires setting systemd property "Delegate=yes", see https://kind.sigs.k8s.io/docs/user/rootless/

I got the same problem

update your crun version

jocutajar commented 5 months ago

The unit file seems to be ignored on my systemd as well (debian bookworm).

This -p "Delegate=yes" seems to have done it:

systemd-run --scope --user -p "Delegate=yes" kind create cluster

Found the trick in regard to LXC.

jsmrcka commented 4 months ago

The unit file seems to be ignored on my systemd as well (debian bookworm).

This -p "Delegate=yes" seems to have done it:

systemd-run --scope --user -p "Delegate=yes" kind create cluster

Found the trick in regard to LXC.

* podman version 4.3.1

* crun version 1.8.1

* systemd 252 (252.22-1~deb12u1)

* kind version 0.22.0

That did the trick for me too, thanks.

domeales-paloit commented 2 months ago

The unit file seems to be ignored on my systemd as well (debian bookworm).

This -p "Delegate=yes" seems to have done it:

systemd-run --scope --user -p "Delegate=yes" kind create cluster

Found the trick in regard to LXC.

  • podman version 4.3.1
  • crun version 1.8.1
  • systemd 252 (252.22-1~deb12u1)
  • kind version 0.22.0

Worked for me too, cheers!

BenTheElder commented 2 months ago

mind adding an update to https://kind.sigs.k8s.io/docs/user/rootless/#creating-a-kind-cluster-with-rootless-podman ?

jstaf commented 2 months ago

None of these suggestions seem to work on OpenSUSE Tumbleweed. To reproduce:

ERROR: failed to create cluster: running kind with rootless provider requires setting systemd property "Delegate=yes", see https://kind.sigs.k8s.io/docs/user/rootless/
khanhtc1202 commented 3 weeks ago

@BenTheElder I submitted a patch for the docs :pray: