Skip to main content

REST Endpoint

The Cloudders operator provides a REST JSON endpoint that delivers the current health check statuses of your services. This feature is designed to facilitate seamless integration with your applications, providing real-time visibility into the health of your services and their dependencies.

Accessing the REST Endpoint

The REST endpoint can be accessed via the service named your-helm-install-rest-service in the operator namespace. The service listens on port 8082 and exposes the health check statuses at the /healthchecks path.

Example URL:

http://your-helm-install-rest-service.<operator-namespace>:8082/healthchecks

JSON Response Structure

The endpoint returns a JSON object where each key is the name of a health check, and the value is an object containing the details of that health check's status. Below is an example of the JSON structure you can expect:

{
"service-8080": {
"name": "service-8080",
"healthy": true,
"response": "Connection Successful",
"state": "Active"
},
"service-9090": {
"name": "service-9090",
"healthy": false,
"response": "Timeout",
"state": "Errored"
}
}

Fields Explained

  • name: The name of the health check.
  • healthy: A boolean indicating if the service is healthy.
  • response: A message providing details about the health check result.
  • state: The current state of the health check, which can be:
    • Active: The health check is running normally.
    • CheckBackoff: The health check is in a backoff state due to rate limiting.
    • Errored: The health check configuration is incorrect or an error occurred during execution.

Use Cases

Integration with Monitoring Tools

You can integrate the health check statuses into your existing monitoring tools to get a comprehensive view of your service health. This integration allows you to set up alerts, dashboards, and automated responses based on the health check data.

Real-time Application Insights

By consuming the health check statuses in your application, you can make real-time decisions based on the health of your dependencies. For example, you can route traffic away from unhealthy services or display status messages to users.

Automation and Orchestration

The REST endpoint enables automation scripts and orchestration tools to query the health statuses and perform actions such as scaling services, restarting pods, or triggering failovers in response to health check results.

Example Integration Here's an example of how you might query the REST endpoint using curl:

# kubectl port-forward svc/your-helm-install-rest-service 8082:8082
curl http://your-helm-install-rest-service.<operator-namespace>:8082/healthchecks

The response will be a JSON object containing the status of all configured health checks as shown above, which you can then parse and use in your automation scripts or monitoring setups.

Conclusion

The REST endpoint provided by the Cloudders Health Check Operator is a powerful tool for integrating health check data into your applications and monitoring systems. By leveraging this feature, you can enhance the reliability and observability of your services, ensuring that you are always informed about the health of your infrastructure.