Kong: Improvement: add /readiness endpoint for Kubernetes hosting

Created on 23 Sep 2016  路  5Comments  路  Source: Kong/kong

Summary

To run Kong in Kubernetes a /readiness endpoint will tell Kubernetes whether a node is ready to receive traffic and make it part of a service by returning 200 OK. Failing to return 200 OK will - temporarily - remove the node from the service.

Combined with the /liveness endpoint - see https://github.com/Mashape/kong/issues/1677 - this makes running Kong in Kubernetes much more effective.

proposal

Most helpful comment

I would like to have a proper HTTP health check for Kong too. In our situation, we have Kong fronted by an AWS ELB which executes HTTP requests for health checking.

As I have the global http-log plugin configured, @filotti's solution causes all the health checks (6 per minute per ELB instance per Kong instance to be logged.

the /liveness can be easily added to the kong NGiNX template.

the /readiness would ready to determine the health state of Kong.

All 5 comments

+1
For sure would be very usefull for the integration of Kong into Kubernetes, for a production grade level.

@JorritSalverda Kong already comes with a kong health command to check its health, this can be used as a readiness/liveness probe:

        readinessProbe:
          exec:
            command:
            - kong
            - health
          initialDelaySeconds: 3

Kubernetes Ingress requires the readinessProbe to be an httpGet (without autentication), and I'm having a hard time finding an endpoint on the proxy port that returns http status 200 without calling another API...

I was able to solve my problem by adding a dummy API with a non-existent upstream uri and then using the request-termination plugin to always return status 200.

I would like to have a proper HTTP health check for Kong too. In our situation, we have Kong fronted by an AWS ELB which executes HTTP requests for health checking.

As I have the global http-log plugin configured, @filotti's solution causes all the health checks (6 per minute per ELB instance per Kong instance to be logged.

the /liveness can be easily added to the kong NGiNX template.

the /readiness would ready to determine the health state of Kong.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeremyjpj0916 picture jeremyjpj0916  路  34Comments

subnetmarco picture subnetmarco  路  97Comments

jeremyjpj0916 picture jeremyjpj0916  路  59Comments

SunshineYang picture SunshineYang  路  39Comments

sonicaghi picture sonicaghi  路  47Comments