在我们的 k8s 入口配置中,我们将超时设置为 10 分钟,并将其应用于所有请求。是否可以仅为两个请求(如/my-service/v1/processfile
和)配置超时/my-service/v1/cachewarmup
。
目前我们的配置如下:
---
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
谁能帮我将 nginx 入口超时配置为两个请求为 10 分钟,所有其他请求默认为 1 分钟。
答案1
是的,您可以指定Ingress
仅包含这两条路径的单独资源,因为 Ingress 按最具体的模式匹配:
---
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