Open unixfox opened 1 month ago
I think the simplest way to implement the healthcheck would be to add a cmdline parameter to the main binary that instead of starting the server would check if the server is responsive, probably by sending a simple request like PLAYER_STATUS
and waiting no more than 1 second for a response.
While K8s natively supports a variety of liveness probes, including commands and HTTP, docker and podman appear to only support running healthcheck commands inside the container. Checking the HTTP healthcheck endpoint in docker and podman would require including an http client binary in the image, including any dependencies if dynamically linked. (the final image is built from scratch) Another rust dependency would likely need to be included for the HTTP server.
On the other hand, implementing a command-based healthcheck would only require adding another cmdline flag to check the server and exit with either 0 or 1.
I think the simplest way to implement the healthcheck would be to add a cmdline parameter to the main binary that instead of starting the server would check if the server is responsive, probably by sending a simple request like
PLAYER_STATUS
and waiting no more than 1 second for a response.While K8s natively supports a variety of liveness probes, including commands and HTTP, docker and podman appear to only support running healthcheck commands inside the container. Checking the HTTP healthcheck endpoint in docker and podman would require including an http client binary in the image, including any dependencies if dynamically linked. (the final image is built from scratch) Another rust dependency would likely need to be included for the HTTP server.
On the other hand, implementing a command-based healthcheck would only require adding another cmdline flag to check the server and exit with either 0 or 1.
We just need a simple flag in the main binary, no need for any HTTP-related stuff.
@techmetx11 we would like to offer an healthcheck endpoint. Could be used on Kubernetes or Docker.
What would be the ideal way? Have a separate very small HTTP server running which provides only a healthcheck?
Or sending some data using netcat to the code?
We would prefer to have something more in depth than just checking the port.