palworld-server-docker
palworld-server-docker copied to clipboard
Add lifecycle preStop stop hook and probes to Kubernetes
Is your feature request related to a problem? Please describe.
Not necessarily a problem but I can see it being one in certain use-cases.
Describe the solution you'd like
Make a script to gracefully shutdown Palworld with Rcon via a script in the container with a prestop hook (https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/) and example of this would be something like:
lifecycle:
preStop:
exec:
command:
- /pal-graceful-shutdown.sh
In the script we can simply execute something like /Shutdown {Seconds} {MessageText}
This is similar to https://github.com/thijsvanloef/palworld-server-docker/pull/172 albeit a bit more simple
I think it would also be useful to add probes to Kubernetes so in the case something go unhealthy the pod will automatically restart. I think this may be a bit trickier since I don't think Kubernetes supports raw UDP probes like it does with TCP https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#tcp-probes
Kubernetes does not support UDP liveness probes.
I think the approach using preStop can perform a backup before terminating the pod.
Kubernetes does not support UDP liveness probes.
+1 I don't think it does either. I suppose our best bet is to use a command (exec.command) https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command that test the liveliness in a container with some kind of script.
I think the approach using preStop can perform a backup before terminating the pod.
Yes I agree! That would be great