helper module to inject a prob to a custom nodejs microservice
npm install k8s-probesThis 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
Spin up an http server that expose an endpoint that when is up always return 200
``javascript
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})
`
The readiness probe support the following configs:
- port : The port where the server listen for readiness probes, default to 9999path
- : The path where the server listen for readiness probes, default to /_ready`
| ENV VARIABLE NAME | Description |
| --- | --- |
| K8S_PROBES_DISABLE | Disable the probe server completely, useful when developing to avoid port collision |