k8s-probes
v1.0.2
Published
helper module to inject a prob to a custom nodejs microservice
Downloads
6
Maintainers
Readme
k8s-probes
This repo offers an helper to expose an http probe endpoint that kubelet can use to check container status: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#reference
At the moment we only implement readiness prob
Readiness Probe
Spin up an http server that expose an endpoint that when is up always return 200
const port = 9999;
const path = '/ready';
// initialize the prober server on custom port
const prober = require(k8s-probe)({port});
// do your own service async initialization in here
// ...
// once your service is ready just call the probe to expose the endpoint
prober.isReady({path})
CONFIGURATION
The readiness probe support the following configs:
port
: The port where the server listen for readiness probes, default to9999
path
: The path where the server listen for readiness probes, default to/_ready
ENVIRONMENT VARIABLE
| ENV VARIABLE NAME | Description | | --- | --- | | K8S_PROBES_DISABLE | Disable the probe server completely, useful when developing to avoid port collision |