Skip to content

ratulSharker/k8-probes

Repository files navigation

Dev.to blog Docker Kubernetes NodeJS Express.js Docker Image CI

k8-probes

Blog post:

This repository is better accompanied with the blog post My understanding was wrong about readiness and liveliness probes and killercoda.com

Background:

For better availability of services, kubernetes offers three type of probes:

  • Startup Probe.
  • Readiness Probe.
  • Liveliness Probe.

To accomodate exploring these probes, requires following:

  • A simple rest service.
  • Containerisation of the rest service.
  • Kubernetes deployment definitions.

This repository covers all above points for exploring the kubernetes probes.

Implementation details:

Rest Service:

  • A simple nodejs + expressjs service.
  • Exposed three routes /liveliness, /readiness & /startup.
  • Each of these routes logs with timestamp.
  • Each of these routes response code can be controlled via environment variables.

Containersation:

  • Docker is used in containerisation of the rest service.
  • Used Dockerhub to store the container image.
  • docker-compose.yaml for local testing and image pushing into Dockerhub.

Kubernetes Deployment:

  • playground named namespace declared in the definition.
  • Environments variables are configured for response codes for routes.
  • Two different deployment files added, with startup probe and another without startup probe configured.