Skip to content
Kong Logo | Kong Docs Logo
search
  • We're Hiring!
  • Docs
    • Kong Gateway
    • Kong Konnect
    • Kong Mesh
    • Plugin Hub
    • decK
    • Kubernetes Ingress Controller
    • Insomnia
    • Kuma

    • Docs contribution guidelines
  • Plugin Hub
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Plugin Hub
  • decK
  • Kubernetes Ingress Controller
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • 3.3.x (latest)
  • 3.2.x
  • 3.1.x
  • 3.0.x
  • 2.8.x
  • 2.7.x
  • 2.6.x
  • Older Enterprise versions (2.1-2.5)
  • Older OSS versions (2.1-2.5)
  • Archive (pre-2.1)

github-edit-pageEdit this page

report-issueReport an issue

enterprise-switcher-iconSwitch to OSS

On this pageOn this page
  • Prerequisites
  • Understanding the Node Readiness endpoint
    • Traditional mode
    • Hybrid mode (data_plane role) or DB-less mode
    • Hybrid mode (control_plane role)
  • Enabling the Status endpoint
  • Using the Node Readiness endpoint
  • Updating Readiness Probes
  • See also
Kong Gateway
3.3.x (latest)
  • Home
  • Kong Gateway
  • Production Deployment
  • Monitoring
  • Readiness Check

Readiness Check

This tutorial guides you through the process of using the Node Readiness endpoint, which provides a reliable way to determine if Kong Gateway is ready to serve user requests.

The readiness check endpoint returns a 200 OK response when Kong Gateway is ready, or a 503 Service Temporarily Unavailable response when it’s not. This is useful for load balancers and other tools that need to monitor the readiness of Kong instances. When Kong is not ready, the endpoint responds back with a message field with the reason for unreadiness. This can be helpful to debug situations where the user expects that the node should be ready but is not.

Note: The readiness endpoint does not return detailed information about the node status.

Prerequisites

  • Kong Gateway
  • A basic understanding of Kong Gateway configuration and deployment modes (traditional, DB-less, and hybrid)

Understanding the Node Readiness endpoint

Before diving into the steps, it’s important to understand the purpose of the Node Readiness endpoint and how it determines whether a Kong instance is ready or not.

Traditional mode

In traditional mode, the endpoint returns 200 OK when all of the following conditions are met:

  1. Successful connection to the database
  2. All Kong workers are ready to route requests
  3. All routes and services have their plugins ready to process requests

Hybrid mode (data_plane role) or DB-less mode

In Hybrid mode (data_plane role) or DB-less mode, the endpoint returns 200 OK when the following conditions are met:

  1. Kong has loaded a valid and non-empty config (kong.yaml)
  2. All Kong workers are ready to route requests
  3. All routes and services have their plugins ready to process requests

Hybrid mode (control_plane role)

In Hybrid Mode (control_plane role), this endpoint returns 200 OK when the following condition is met:

  1. Successful connection to the database

Enabling the Status endpoint

In order to use the Node Readiness endpoint, make sure that you have enabled the Status API server (disabled by default) via the status_listen configuration parameter.

Example kong.conf:

status_listen = 0.0.0.0:8100

Using the Node Readiness endpoint

Once you’ve enabled the Node Readiness endpoint, you can send a GET request to check the readiness of your Kong Gateway instance:

# Replace `<status-api-host>` with the appropriate host for
# your Status API server, including the port number

curl -i <status-api-host>/status/ready

If the response code is 200, the Kong Gateway instance is ready to serve requests:

HTTP/1.1 200 OK
Date: Thu, 04 May 2023 22:00:52 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Content-Length: 19
X-Kong-Admin-Latency: 3
Server: kong/3.3.0

{
  "message": "ready"
}

If the response code is 503, the Kong Gateway instance is unhealthy and/or not yet ready to serve requests:

HTTP/1.1 503 Service Temporarily Unavailable
Date: Thu, 04 May 2023 22:01:11 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Content-Length: 43
X-Kong-Admin-Latency: 3
Server: kong/3.3.0

{
  "message": "failed to connect to database"
}
HTTP/1.1 503 Service Temporarily Unavailable
Date: Thu, 04 May 2023 22:06:58 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Content-Length: 70
X-Kong-Admin-Latency: 16
Server: kong/3.3.0

{
  "message": "no configuration available (empty configuration present)"
}

Updating Readiness Probes

If you’re using Kubernetes or Helm, you may need to update the readiness probe configuration to use the new Node Readiness endpoint. Modify the readinessProbe section in your configuration file to look like this:

readinessProbe:
    httpGet:
        path: /status/ready
        # Make sure to replace the port number with the one you
        # configured for the Status API Server.
        port: 8100
    initialDelaySeconds: 10
    periodSeconds: 5

See also

For more information on Kong and related topics, check out the following resources:

  • Kong Admin API Documentation
  • Get Started with Kong Ingress Controller
  • Kong Helm Chart
Thank you for your feedback.
Was this page useful?
  • Kong
    THE CLOUD CONNECTIVITY COMPANY

    Kong powers reliable digital connections across APIs, hybrid and multi-cloud environments.

    • Company
    • Customers
    • Events
    • Investors
    • Careers Hiring!
    • Partners
    • Press
    • Contact
  • Products
    • Kong Konnect
    • Kong Gateway
    • Kong Mesh
    • Get Started
    • Pricing
  • Resources
    • eBooks
    • Webinars
    • Briefs
    • Blog
    • API Gateway
    • Microservices
  • Open Source
    • Install Kong Gateway
    • Kong Community
    • Kubernetes Ingress
    • Kuma
    • Insomnia
  • Solutions
    • Decentralize
    • Secure & Govern
    • Create a Dev Platform
    • API Gateway
    • Kubernetes
    • Service Mesh
Star
  • Terms•Privacy
© Kong Inc. 2023