OpenShift Service Proxy timeout
Asked Answered
K

2

14

I have an application deployed on OpenShift Container Platform v3.6. It consists of multiple services interconnected to each other.

The frontend service calls a time consuming function of the backend service (through a REST call), but after 30 seconds it receives a "504 Gateway Timeout" message. Frontend runs over nginx, but I've already configured it with long proxy send/read timeouts, so the 504 message doesn't come from it. I think it comes from the Service Proxy component of OpenShift Platform, but I can't find out where and how configure a kind of service proxy timeout. I know the existence of HAProxy timeout for external routes, but my services leave in the same cluster application and communicate each other via OpenShift Container Platform DNS.

Could be a Service Proxy timeout issue? How can it be configured?

Thanks!

Klaxon answered 14/12, 2017 at 11:56 Comment(1)
Have you tried accessing the backend on the pod, using curl to 127.0.0.1? At the very least, it can rule put your application.Iloilo
C
26

Your route timeout is the culprit. The haproxy ingress router is terminating the request. You can configure the timeout by following the docs below:

https://docs.openshift.com/container-platform/3.5/install_config/configuring_routing.html

For example:

# Set the timeout on 'longrunningroute' to five minutes.
oc annotate route longrunningroute --overwrite haproxy.router.openshift.io/timeout=5m
Chloroprene answered 14/12, 2017 at 13:26 Comment(1)
The default value of route is defined in ROUTER_DEFAULT_SERVER_TIMEOUT as 30s, in most cases, this is long enough, you can increase it if your app is SLOW.Autoradiograph
G
2

In my case I didn't annotate the route myself but added the annotation to the Ingress.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
  namespace: my-namespace
  annotations:
    haproxy.router.openshift.io/timeout: 600s
spec:
  tls:
    - hosts:
        - example.com
      secretName: https-tls-secret
  rules:
    - host: example.com
      http:
        paths:
          - path: /testpath
            pathType: Prefix
            backend:
              service:
                name: test
                port:
                  number: 80

The routes are managed by the ingress and therefore inherit the annotations from it.

Gatehouse answered 26/1, 2023 at 12:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.