2

In our k8s ingress configuration we set timeout to 10min and its applying to all requests. Is it possible to configure timeout only to two requests like /my-service/v1/processfile and /my-service/v1/cachewarmup.

Currently our configuration is as follows:

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-service
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '600'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '600'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '600'
spec:
  rules:
  - host: my-service-dev1.eus1-devqa.geo.com
    http:
      paths:
      - path: /
        backend:
          serviceName: my-service-svc
          servicePort: 8080

Can anyone please help me to configure nginx ingress timeout for two requests only to 10min and all other requests default to 1min.

Geo
  • 575
  • 3
  • 9
  • 23

1 Answers1

6

Yes, you can specify a separate Ingress resource that contains only those two paths, since Ingress matches by most specific pattern:

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-service
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '60'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '60'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '60'
spec:
  rules:
  - host: my-service-dev1.eus1-devqa.geo.com
    http:
      paths:
      - path: /
        backend:
          serviceName: my-service-svc
          servicePort: 8080
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-service-600
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '600'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '600'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '600'
spec:
  rules:
  - host: my-service-dev1.eus1-devqa.geo.com
    http:
      paths:
      - path: /my-service/v1/processfile
        backend:
          serviceName: my-service-svc
          servicePort: 8080
      - path: /my-service/v1/cachewarmup
        backend:
          serviceName: my-service-svc
          servicePort: 8080
mdaniel
  • 2,561
  • 1
  • 9
  • 13
  • hi @mdaniel Thanks a lot... its working fine.. – Geo Dec 21 '20 at 07:16
  • I am also facing the same issue with keycloak and see [error] 17297#17297: *91945328 upstream timed out (110: Operation timed out) while connecting to upstream, client: 10.233.74.64, server: keycloak.dev.testlab.tech, request: "GET /auth/ HTTP/2.0", upstream: "https://10.244.98.160:8443/auth/". After creating separate "keycloak.dev.testlab.tech", same issue remains. – Sanjeev Jan 22 '23 at 14:44
  • @Sanjeev please don't squat on other people's questions; asking questions is free, and there is no way you can provide the amount of detail required to help you in the comment field. Good luck – mdaniel Jan 22 '23 at 15:06
  • @mdaniel, my query was based on same original issue, except the application is keycloak. Fyi comment section is for **hints** not for detailing out. By the way, I have the solution to my issue. I am on bare metal k8 cluster where I was trying with N/W policy=true. I set it false for the time being & I cleared the browser cache too (this can also the cause of the issue) – Sanjeev Jan 22 '23 at 17:36