Skip to main content

Version: 3.2.16.7

Perform Gateway Health Probing

Health check probing is essential for ensuring the stability and reliability of API7 Enterprise in a production environment. When requests are routed through a load balancer (LB) before reaching the API7 Gateway, the LB can rely on health check probes—such as a status endpoint provided by the Gateway—to monitor its operational state. These probes allow the LB to determine whether the Gateway instances are healthy and ready to handle incoming traffic. If an instance is deemed to be unhealthy, the LB automatically re-routes requests to healthy instances, preventing disruptions and downtime. This mechanism ensures high availability, minimizes the risk of routing requests to unresponsive nodes, and enhances the overall user experience by maintaining continuous service delivery.

This tutorial walks you through the process of enabling the health check probes and checking for Gateway liveness readiness.

Enable Health Check Probes

By default, the status probing is not enabled. To enable the check, add the following configuration to the Gateway's configuration file:

config.yaml
apisix:
status:
ip: 0.0.0.0
port: 7085

❶ Configure the listening IP to 0.0.0.0 for when the Gateway is deployed in Docker. Fall back to 127.0.0.1 if unconfigured. Adjust accordingly per your deployment.

❷ Configure the listening port to 7085.

Once enabled, the Gateway will provide /status and /status/ready endpoints for health check probing.

Check Gateway Running Status

The /status endpoint can be used to verify whether the Gateway has successfully started and running. For example, you can send the following request to the Gateway at a regular interval:

curl "http://127.0.0.1:7085/status"

If the Gateway is healthy, you should receive 200 OK responses. If the Gateway is not healthy, you should not receive any response and may observe connection refused.

Check Gateway Readiness for Traffic

The /status/ready endpoint can be used to verify whether the Gateway is ready to proxy traffic. For example, you can send the following request to the Gateway at a regular interval:

curl "http://127.0.0.1:7085/status/ready"

If the Gateway is ready to proxy traffic, you should receive 200 OK responses. If not ready, you should receive 503 Service Temporarily Unavailable responses.

The readiness is determined by the availability of the database nodes, reported by the DP Manager. The Gateway will respond with 200 OK responses if at least one database node is available. If none of the database nodes is available, the Gateway will respond with 503 Service Temporarily Unavailable.

Configure Readiness Probes in Kubernetes

If you are using Kubernetes, you can leverage the readiness probe configuration to check for Gateway readiness. Update the relevant manifest file with the following section:

readinessProbe:
httpGet:
path: /status/ready
port: 7085
initialDelaySeconds: 5
periodSeconds: 5

❶ Set to the Gateway probing endpoint.

❷ Set to the Gateway probing port.

❸ Wait 5 seconds before performing the first probe.

❹ Wait 5 seconds before performing the first probe.

See Configure Liveness, Readiness and Startup Probes for more information.


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation