quanwei li
quanwei li

Reputation: 359

How add nginx-ingress custom health check behind a nginx reverse proxy

I have a nginx server outside kubernetes. nginx -> nginx ingress. I want know how add a custom health check path /health/status to nginx ingress.

Upvotes: 0

Views: 4354

Answers (1)

mdaniel
mdaniel

Reputation: 33231

This question is almost certainly solving the wrong problem, but in the spirit of answering what was asked:

You can expose the Ingress /healthz to the outside world:

kind: Service
metadata:
  name: ingress-nginx-health
spec:
  type: ClusterIP
  selector: # whatever
  ports:
  - name: healthz
    port: 80
    targetPort: 10254
---
kind: Ingress
spec:
  rules:
  - host: elb-1234.example.com
    http:
      path: /healthz
      backend:
        serviceName: ingress-nginx-health
        servicePort: healthz

Because if your Ingress controller falls over, it will for sure stop answering its own healthz check

Upvotes: 1

Related Questions