Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container restart policy when using podman #2998

Open
bpfoster opened this issue Nov 10, 2022 · 6 comments
Open

Add container restart policy when using podman #2998

bpfoster opened this issue Nov 10, 2022 · 6 comments
Labels
area/provider/podman Issues or PRs related to podman kind/feature Categorizes issue or PR as related to a new feature.

Comments

@bpfoster
Copy link
Contributor

bpfoster commented Nov 10, 2022

What would you like to be added: The kind-control-plane container to have a restart policy when launched with podman

Why is this needed: The container has a restart policy when launched with docker, but launching with podman does not set this policy.

While it's true that podman doesn't handle restarts on its own, since v3.3.0, podman does come with an available systemd service that will restart all containers with restart-policy=always.

I realize this is a different policy than is used with docker. It would be nice to use the systemd service was-is (requiring an always restart policy), but even if you chose to set the same on-failure policy as is used on docker, a copy/paste/tweak could be made to the systemd service file to make it work as expected.

This would be nice to be able to utilize so that whenever I restart the machine, or logout/login, the kind cluster comes up automatically like I have come to expect in a docker environment.

Supporting information:

$ docker inspect kind-control-plane --format '{{ .HostConfig.RestartPolicy.Name }}' 
on-failure
$ podman inspect kind-control-plane --format '{{ .HostConfig.RestartPolicy.Name }}'

Kind docker provisioner:
https://github.com/kubernetes-sigs/kind/blob/main/pkg/cluster/internal/providers/docker/provision.go#L166

Kind podman provisioner:
https://github.com/kubernetes-sigs/kind/blob/main/pkg/cluster/internal/providers/podman/provision.go#L170

@bpfoster bpfoster added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 10, 2022
@BenTheElder
Copy link
Member

Always is not a very appropriate policy (see the lengthy code comment on the docker policy).

is that service always enabled?

@BenTheElder
Copy link
Member

Also, podman based multi node clusters probably won't restart properly anyhow, because the lack of container hostname resolution vs docker embedded dns.

@bpfoster
Copy link
Contributor Author

is that service always enabled?

It was not enabled on my distro by default, had to do that like so:
systemctl --user enable podman-restart.service

@BenTheElder
Copy link
Member

ACK, I think this is a dupe of #2272

@benoitf
Copy link

benoitf commented Dec 9, 2022

the podman-restart.service should be included on Podman 4.4.0 and onwards
containers/podman#16672
containers/podman#16669

@aojea
Copy link
Contributor

aojea commented Dec 10, 2022

the podman-restart.service should be included on Podman 4.4.0 and onwards

the problem is how do you support a feature like that on old versions? we already have a lot of if version x do Y else do Z and that is very complex to support and sustain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/podman Issues or PRs related to podman kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants