如何更改 OpenShift 中路由的 HTTP 请求响应允许的超时?

diz*_*iaq 5 timeout connection-timeout openshift kubernetes

OpenShift 4.6

OpenShift 中有一个基本设置:[Pod <- Service <- Route]。Pod 中运行的服务的 HTTP 端点响应时间为 90 秒或更长时间。在某些情况下这是正常的,所以我愿意允许这种行为。

然而,在发送对路由的请求(并且响应没有返回)之后(大约 60-70 秒),路由会响应HTTP 504

<html>
<body>
    <h1>504 Gateway Time-out</h1>
    The server didn't respond in time.
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我不确定 OpenShift 在什么时候决定断开电路,而且我找不到任何允许更改此超时的配置选项。

如何为服务和 Pod 设置自定义超时以延长请求-响应周期的持续时间?

Sim*_* K. 5

您可能正在寻找haproxy.router.openshift.io/timeout注释,您可以用它来注释您的路线:

oc annotate route myroute --overwrite haproxy.router.openshift.io/timeout=2s
Run Code Online (Sandbox Code Playgroud)

您可以在文档中找到有关路由配置的更多信息:https://docs.openshift.com/container-platform/4.6/networking/routes/route-configuration.html#nw-configuring-route-timeouts_route-configuration