如何更改 kong ingress 3.1.x 上的上游超时? 之前(版本2.7.x),我使用的是这个插件:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: up-timeout
annotations:
kubernetes.io/ingress.class: kong
labels:
global: "true"
plugin: upstream-timeout
config:
connect_timeout: 30000
send_timeout: 3600000
read_timeout: 3600000
我也在服务yaml上尝试了这个注释:
apiVersion: v1
kind: Service
metadata:
name: logistics-simulator
annotations:
konghq.com/override: kong-timeout
konghq.com/connect-timeout: 3600000
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: logistics-simulator
但是我在使用上面的 yaml 代码的 AKS 上遇到此错误:
错误:无法解码 “/home/vsts/work/_temp/Service_logistics-simulator_1712325946614”: json:无法将数字解组到 Go 结构字段中 字符串类型的 ObjectMeta.metadata.annotations ##[错误]错误:无法解码“/home/vsts/work/_temp/Service_logistics-simulator_1712325946614”: json:无法将数字解组到 Go 结构字段中 字符串类型的 ObjectMeta.metadata.annotations
看起来这是一个错误,因为资源正在将 JSON/YAML 数据发送到后端相应的 Kong go 服务,并且无法对其进行解组(预计不是数字)。我会尝试在超时值上加上引号(字符串而不是数字)
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: up-timeout
annotations:
kubernetes.io/ingress.class: kong
labels:
global: "true"
plugin: upstream-timeout
config:
connect_timeout: "30000"
send_timeout: "3600000"
read_timeout: "3600000"
和
apiVersion: v1
kind: Service
metadata:
name: logistics-simulator
annotations:
konghq.com/override: kong-timeout
konghq.com/connect-timeout: "3600000"
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: logistics-simulator