marathon-lb health check failing on all spray.io containers

偶尔善良 提交于 2020-01-01 19:35:19

问题


I'm running DC/OS 1.7 with marathon-lb.

spray.io 1.3.3 is returning 400 to all marathon-lb/HAProxy heath check calls: request has a relative URI and is missing a Host header so marathon-lb never routes any requests to the service.

The health check in the marathon json is:

   "healthChecks": [
     {
       "path": "/health",
       "protocol": "HTTP",
       "portIndex": 0,
       "gracePeriodSeconds": 10,
       "intervalSeconds": 2,
       "timeoutSeconds": 10,
       "maxConsecutiveFailures": 10,
       "ignoreHttp1xx": false
     }   ],

and the logging by spray.io in the docker container is:

[WARN] [08/19/2016 23:53:42.534] [asp-service-akka.actor.default-dispatcher-5] [akka://asp-service/user/IO-HTTP/listener-0/4] Illegal request, responding with status '400 Bad Request': Illegal request: Cannot establish effective request URI of HttpRequest(GET,/health,List(),Empty,HTTP/1.0), request has a relative URI and is missing a Host header

The /health endpoint works fine from curl against the mesos managed ip:port.

I can't find any docs on making HAProxy via marathon-lb more forgiving or suppressing spray.io's 400.


回答1:


from the mesosphere team, sends the hostname in header via the "labels": { section in the marathon json:

    "HAPROXY_0_BACKEND_HTTP_HEALTHCHECK_OPTIONS": "  http-send-name-header Host\n  timeout check {healthCheckTimeoutSeconds}s\n"




回答2:


Please try to add the HAPROXY_BACKEND_HTTP_HEALTHCHECK_OPTIONS label, you can try to replace www with {hostname} in this example: https://github.com/mesosphere/marathon-lb/wiki#custom-http-headers-in-health-check

Additional links:

  1. https://github.com/mesosphere/marathon-lb/blob/master/Longhelp.md#haproxy_backend_http_healthcheck_options
  2. https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-option%20httpchk


来源:https://stackoverflow.com/questions/39049235/marathon-lb-health-check-failing-on-all-spray-io-containers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!