Closed JorritSalverda closed 3 years ago
+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.
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.