ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Turn off returning HTTP OK for /healthz endpoint during preStop hook to allow AWS NLB unhealthy draining

Open youwalther65 opened this issue 5 months ago • 2 comments

AWS NLB has a feature called unhealthy draining, see Connection termination for unhealthy targets which together with the additional feature connection termination disabled allows that the target is considered unhealthy and won't receive new connections, but established connections are kept active, allowing them to gracefully close.

Currently even during NGINX Ingress pod in terminating state the pod /healthz endpoint returns HTTP 200 ok, so new connections to the terminating NGINX Ingress pod are allowed from NLB.

By using NLB target HTTP health check on port 10254 path /healthz and being able to return non-200 OK during preStop hook (either by returning non-200 by default or make it configurable to turn off /healthz 200 OK in preStop hook) the above AWS NLB feature could be used to stop sending new connections to NGINX Ingress pods earlier.

youwalther65 avatar Aug 27 '24 07:08 youwalther65