Handles k8s liveness and readiness probes. Use as the first plug in endpoint.ex.
GET /probe/liveness→ 200 while the BEAM is running.GET /probe/readiness→ 200 whenKubernetesProbes.Draineris:runningand the optionalready?function returnstrue; 503 otherwise.
Usage
# lib/my_app_web/endpoint.ex — before all other plugs
plug KubernetesProbes.Plug
# With a custom readiness check (e.g. database connectivity)
plug KubernetesProbes.Plug, ready?: &MyApp.repos_ready?/0
# With custom probe paths
plug KubernetesProbes.Plug, liveness_path: "/healthz", readiness_path: "/readyz"Options
:ready?— zero-arity boolean function called on each readiness request while the drainer is:running. Must be a remote function capture (&MyApp.repos_ready?/0), not an anonymous function. Defaults to&KubernetesProbes.Plug.always_ready/0(always returnstrue).:liveness_path— path for the liveness probe. Defaults to"/probe/liveness".:readiness_path— path for the readiness probe. Defaults to"/probe/readiness".