Reputation: 40520
I've created an HTTP Load Balancer (in Google Cloud Platform) but the health check returns a status of unhealthy. My conclusion is that the health check points to a resource that is protected by basic auth and thus the service returns 401 instead of 200. So my questions are:
Upvotes: 1
Views: 3284
Reputation: 53
Health checks in Google Cloud cannot be provided basic auth credentials to my knowledge. You are correct, in that they expect the status code to be 200 so any endpoint requiring basic auth would fail the health check.
The solution we came up with to resolve this was to have 2 endpoints. One endpoint returns useful status information that we can pull up and look into (which we want behind authorization). We then created a ping
endpoint, that uses the same checks as before, only it doesn't display any status information. Just a simple pass/fail message. We leave this endpoint exposed and point the health checks there.
Upvotes: 3
Reputation: 130
HTTP Healthcheck does not use basic auth credentials. This looks like some other issue. 1. Can you ssh into your instance successfully? 2. Does the app can actually answer path you provided as part of health check config ?
See more details in https://cloud.google.com/compute/docs/load-balancing/health-checks
Upvotes: -3