Miss any of our Open RFC calls?Watch the recordings here! »

k8s-probes

1.0.2 • Public • Published

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 to 9999
  • 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

Install

npm i k8s-probes

DownloadsWeekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

2.29 kB

Total Files

4

Last publish

Collaborators

  • avatar