Simple healthcheck endpoint in kong gateway

2.7k Views Asked by At

I have a docker container running with kong gateway.

I want to provide a rest interface/endpoint to check the health of the server and container. E.g. GET http://container.com/health/ which delivers
200 OK '{"status":"UP"}';

What is the simplest and quickest solution or best practice?

1

There are 1 best solutions below

0
On

You can create a /health route and enable the request-termination plugin like so:

routes:
- name: health
  paths:
  - /health
  plugins:
  - name: request-termination
    config:
     status_code: 200
     content_type: application/json
     body: '{"status":"UP"}'

That being said, the preferred way of determining the health status of a Kong node is to actually use the built-in health routes (/status endpoint):

https://docs.konghq.com/gateway/latest/admin-api/#health-routes