简体   繁体   中英

Docker in Google App Engine Flexible health check has wrong URL

My service uses a url like this:

<google_url>/v1/lookup_stuff

<google_url>/v1/ is the base url for everything in the service, so when the health check pings <google_url> it gets a 404. I need to update to ping <google_url>/v1/

(Possibly useful information, the service is in Docker, and is accessible when I manually go to the right URL)

How do I point gcloud's health service at the correct URL for my service?

Ok for clarity:

  • Google url: service-something.appspot.com
  • All urls for service are under: service-something.appspot.com/v1

I need to point health checker to:

  • service-something.appspot.com/v1/_ah/health

instead of

  • service-something.appspot.com/_ah/health

Really cryptic-ly exposed question, anyway:

  • if <google_url> is a tag that you designed then split it in two: <google_base_url>/v1/ and <google_path_url>lookup_stuff then you can ping <google_base_url>/v1/ and when you need the original <google_url> = <google_base_url> + <google_path_url>

  • if <google_url> is given to you by some framework, etc, then you need to interpret it, to get the initial part that you need. Maybe you can use a regex pattern, check out this so search

  • a third option is to put a rewrite rule in your web service that will redirect all the pings to the url you need, again check out this so search for apache , and or expand your question explaining what web server you use, what you intend doing, etc etc

Last, check out this nice example on kubernetes-health-check about how configure the liveness probe, there is a path parameter that should be useful

Update:

The flexible environment now supports the Updated health checks , consisting of separately configurable liveness checks and/or readiness checks , both with a configurable path capability.

Note that these updated health checks are not compatible and cannot coexit with the legacy health checks:

You must enable updated health checks for each project individually. By default, legacy health checks are enabled. You cannot use both types of health checks in the same project.

Original answer, applicable only to the legacy health checks:

The path is not currently configurable. From Health checking :

You do not have to do anything special to implement health checking. If your app does not handle health checks, a HTTP 404 response is interpretated as a successful reply.

You can write your own custom health-checking code. It should reply to /_ah/health requests with a HTTP status code 200 . The response must include a message body, however, the value of the body is ignored (it can be empty).

So you can leave it like that - your app being always considered healthy. Or you can teach your app to correctly answer to the health check requests at /_ah/health .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM