cilium / hubble-ui

Observability & Troubleshooting for Kubernetes Services

Home Page:https://www.cilium.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: Health endpoints on both frontend/nginx and backend

mkilchhofer opened this issue · comments

I'd appreciate when hubble would provide health endpoints which could be used as readinessProbe and livenessProbe inside the Cilium helm chart.

As this is a common pattern for all Kubernetes pods, I think it doesn't require additional use cases.

For the nginx / frontend, you could extend the nginx.conf like this:

            location /healthz {
                return 200 'OK';
                add_header Content-Type text/plain;
            }

And for the backend, a dedicated handler would be nice, at least something like:

diff --git a/backend/main.go b/backend/main.go
index 23a4af84..c5935e8b 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -50,6 +50,12 @@ func runServer(cfg *config.Config) {
        )

        handler := http.NewServeMux()
+
+       handler.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
+               w.WriteHeader(http.StatusOK)
+               fmt.Fprintf(w, "Server is healthy")
+       })
+
        handler.HandleFunc("/api/", func(resp http.ResponseWriter, req *http.Request) {
                // NOTE: GRPC server handles requests with URL like "ui.UI/functionName"
                req.URL.Path = req.URL.Path[len("/api/"):]

But it would be better to provide 2 different probes:

  • is the app ready?
  • is it alive?