-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A new liveness probe for router pod #12846
Conversation
0e1cf53
to
8e1855d
Compare
@jeremyeder I think we can contiune discuss about the liveness probe of router pod here. As you can see, currently the haproxy will handle FIVE frontends:
If we use Furthermore, I think a liveness probe's responsibility is to check whether a process is So, rather than relying on these hard-to-decide values to keep the stats endpoint always available, it may be much better to find another way that has no relation with this limit as the pod's liveness probe, while keeping the |
8e1855d
to
12d1af2
Compare
This probe seems way more complex. /healthz is almost always liveness, not readiness (we specifically expose other readiness probes for that). |
Exec is also much heavier than an http endpoint. Also, other platforms that call into the router can't easily use that check and might rely on healthz. I would much prefer a solution that makes healthz obey different connection limits. |
@smarterclayton |
12d1af2
to
2ca0282
Compare
734ccfb
to
be23bb9
Compare
@smarterclayton It may be difficult to make |
21a766a
to
4f49dce
Compare
Perhaps the right thing to do is experiment patching haproxy to special-case /healthz and use that as a starting point for more deeper discussions with haproxy upstream. |
@jeremyeder
|
I'd be ok with a more complex healthz endpoint being hosted by
openshift-router on its own port and use that for liveness probe. But
that check needs to be flexible to many router types, not just haproxy
|
My preliminary proposal contains the following changes in the updated PR :
|
@jmencak @openshift/networking PTAL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a openshift-docs PR that corresponds with these changes?
|
||
.PP | ||
\fB\-\-probe\-timeout\fP="1s" | ||
The timeout that router waits for underlying implementation to reply a probe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reply to a probe (add the "to")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for correction.
if cfg.HostNetwork { | ||
probe.Handler.HTTPGet.Host = "localhost" | ||
} | ||
// Workaround for misconfigured environments where the Node's InternalIP is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this information in the openshift-docs documentation? If its new what is the docs PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the comment here? It has been here for a while and it is just an indentation change here in this PR.
probe.InitialDelaySeconds = 10 | ||
} | ||
return probe | ||
return generateProbeConfigForRouter(cfg, ports, "/alive", 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a 10 sec delay sufficient? Should this be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a default thing that has been used for a while.
If not good for some users, further customization can be through editing the router's DC.
pkg/cmd/infra/router/router.go
Outdated
@@ -73,6 +77,8 @@ func (o *RouterSelection) Bind(flag *pflag.FlagSet) { | |||
flag.BoolVar(&o.AllowWildcardRoutes, "allow-wildcard-routes", cmdutil.Env("ROUTER_ALLOW_WILDCARD_ROUTES", "") == "true", "Allow wildcard host names for routes") | |||
flag.BoolVar(&o.DisableNamespaceOwnershipCheck, "disable-namespace-ownership-check", cmdutil.Env("ROUTER_DISABLE_NAMESPACE_OWNERSHIP_CHECK", "") == "true", "Disables the namespace ownership checks for a route host with different paths or for overlapping host names in the case of wildcard routes. Please be aware that if namespace ownership checks are disabled, routes in a different namespace can use this mechanism to 'steal' sub-paths for existing domains. This is only safe if route creation privileges are restricted, or if all the users can be trusted.") | |||
flag.BoolVar(&o.EnableIngress, "enable-ingress", cmdutil.Env("ROUTER_ENABLE_INGRESS", "") == "true", "Enable configuration via ingress resources") | |||
flag.StringVar(&o.ProbeEndpoint, "probe-endpoint", cmdutil.Env("ROUTER_PROBE_ENDPOINT", "0.0.0.0:1935"), "The http endpoint that router listens on for accepting incoming probes") | |||
flag.StringVar(&o.ProbeTimeoutStr, "probe-timeout", cmdutil.Env("ROUTER_PROBE_TIMEOUT", "1s"), "The timeout that router waits for underlying implementation to reply a probe") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reply "to" a probe
I'm still not sure what I think about the whole idea. @smarterclayton can you give a minute of thought here to tell me I'm wrong? We are going to have a probe which can pass, even when the router is not doing its job. Its job, Its one and only job, is to serve on port 80. The bug is that when the router is overworked and IS NOT SERVING on port 80 that the probe is failing. Is the problem really the probe? If so, this PR makes sense to me. Or is the problem how we REACT to the probe? Is the real problem that when the router is overworked it gets killed and restarted which may only compound the problem? Should we be looking for better way so react? Maybe the solution is somewhere in the middle... Vertical autoscaling under pressure? A probe which only checks stats is port 80 is failing, and only then if the stats tell us that it is working? This whole issues (not just this PR) really rubs me the wrong way, but I still haven't figured out 'the right way'. I just feel sure we looking at it wrong. |
@eparis The problem is with the reaction to the probe. But the current probe does not tell us much - has the pod failed? No. Is the pod overworked that it cannot even handle the probe response? Yes. This PR does not do much to solve the reaction to the old probe response, but re-organizes the code such that we can write specific probe responses when we know what we want to do. The liveness probe is certainly better even if the readiness probe is the same old answer. |
To ultimately prevent bug 1405440, a new, implemnt-independent HTTP-Get health check is introduced by this PR. This new health check is provided by the `openshift-router` process itself. For HAProxy-based router, the health check uses HAProxy's CLI in stats socket for liveness probe, and `/healthz` for readiness probe.
4f49dce
to
21e5de2
Compare
@eparis what problem are we trying to fix here? Sounds like when the system gets resource constrained, things slow down, so what is the real bottleneck? At the least we should have a test that demonstrates that the fix works. Load haproxy to long response times and verify the health probe still returns quickly enough. Changes in the name of performance need very careful testing. |
@eparis The motivation of this fix comes from the BUG 1405440, which points that: the number of active connections reaches HAProxy's global connection limit, HAProxy will also refuse to answer the
And, @pecameron |
Just adding me 2 cents here. The main aim here is to check for liveness that the haproxy process (or the router pod really) is alive. So from a certain perspective, connectivity to the haproxy process does also signal liveness. Maybe the simpler approach is to have the liveness probe use |
For HAProxy, as the connection limit is checked after socket accept in HAProxy, the TCPSocketAction should be succeeded even if connection limit is reached. So @ramr is right, using TCPSocketAction as the liveness probe will be the easist way for now. |
Origin Action Required: Pull request cannot be automatically merged, please rebase your branch from latest HEAD and push again |
Closing this based on the previous conversation. |
To ultimately prevent bug 1405440, a new, implemnt-independent HTTP-Get health check is introduced by this PR. This new health check is provided by the
openshift-router
process itself. For HAProxy-based router, the health check uses HAProxy's CLI in stats socket for liveness probe, and/healthz
for readiness probe.