Open ItalyPaleAle opened 7 months ago
@ItalyPaleAle thanks for reporting this issue.
I was able to reproduce it in a simpler way and will look further into it. I think the root cause is not specific to Quadlet but rather to podman kube play
, but I need to investigate further.
For reference, I was able to reproduce this issue in the following way.
Manually run nginx
and publish the container port 80 on the host's 8000:
podman run --name manual-nginx -d --rm -p 8000:80 docker.io/library/nginx:latest
Generate the nginx.yml
:
podman generate kube manual-nginx > nginx.yml
Edit the file to update the pod and container names.
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
#
# Created with podman-4.7.2
apiVersion: v1
kind: Pod
metadata:
labels:
app: nginx
name: nginx
spec:
containers:
- args:
- nginx
- -g
- daemon off;
image: docker.io/library/nginx:latest
name: nginx
ports:
- containerPort: 80
hostPort: 8000
Save nginx.yml
under ~/.config/containers/systemd
.
Create a nginx.kube
file;
[Kube]
Yaml=nginx.yml
Reload the daemon:
systemctl --user daemon-reload
Start the service
systemctl --user start nginx.service
Check its status
systemctl --user start nginx.service
You can see that it is running
, but the containers failed to start
As I suspected, the root cause of this issue is in kube play
. According to this, Podman notifies READY=1
regardless to the success or failure of the containers. As a result, systemd thinks that the service is running while in fact it has failed.
In addition, I can see that the service container is still running and conmon
does not return.
@vrothberg I remembered that https://github.com/containers/podman/pull/18671 was aiming to address such cases. But, could it be that it fails to do so if the containers failed to start?
@ygalblum that sounds plausible. I am a bit under water at the moment and do not find time to debug.
Issue Description
I have a Quadlet unit which starts a pod (for Traefik). The Pod's spec contains a
port
which binds to a specific network interface on the host.Sometimes, systemd tries to start the Quadlet unit even though the network interface isn't yet ready. The pod fails to start, but systemd reports that the unit is active anyways.
Because systemd reports the unit as active, it is not restarted automatically.
Steps to reproduce the issue
Describe the results you received
Output of
systemctl status traefik.service
:Describe the results you expected
If the pod fails to start, the unit should be in a failed state, so systemd can try restarting the pod.
podman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
No
Additional environment details
No response
Additional information
No response