This is simple nodejs app which can be used as demo micro-service in Docker or Kubernetes. It has health-check endpoint also.
-
/prime
: Will return prime numner between 0 and randomly calculated number named as iteration. This will help you to simulate load on service. -
/greet
: Will return greeting message with current datetime. -
/health-check
: Will return200 OK
, this is for doing health checks within k8s.
-
Clone the repository to your local with
git clone https://github.com/stepsetgo/nodejs-k8s-hello-world.git
-
Change directory to nodejs-k8s-hello-world with
cd nodejs-k8s-hello-world
-
Install dependencies with
yarn install
-
Start server with
node index.js
-
health-check
endpoint can be used for k8s livenessprobe and readinessprobe. -
You need to add a proper
Dockerfile
so that you can build docker image of this.