Search code examples
kubernetestimeoutopenshiftconnection-timeout

How to change allowed timeout for HTTP request-response for a route in OpenShift?


OpenShift 4.6

There is a basic set up in OpenShift: [Pod <- Service <- Route]. A service running in the pod have an HTTP endpoint responding for 90 seconds or longer. And in some cases it is normal, so I would like to allow this behavior.

Nevertheless, after a request to the route is sent (and a response did not arrive back) some time later (approx. 60-70 seconds) route responds with HTTP 504:

<html>
<body>
    <h1>504 Gateway Time-out</h1>
    The server didn't respond in time.
</body>
</html>

I am not sure at what point OpenShift decides to break the circuit and I can't find any configuration options that allow to change this timeout.

How to set custom timeout for a service and a pod to extend duration of request-response cycle?


Solution

  • You might be looking for the haproxy.router.openshift.io/timeout annotation, with which you can annotate your Route:

    oc annotate route myroute --overwrite haproxy.router.openshift.io/timeout=2s
    

    You can find more information about Route configuration in the documentation: https://docs.openshift.com/container-platform/4.6/networking/routes/route-configuration.html#nw-configuring-route-timeouts_route-configuration