全部文章/k8s

ApisixRoute配置后端超时时间

使用ApisixRoute配置后端超时时间

错误示范

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: test-nginx-ar
spec:
  http:
  - name: rule1
    match:
      hosts:
      - test-nginx-ar.default.test.local
      paths:
      - /*
    backends:
       - serviceName: nginx
         servicePort: 80
    timeout:
      connect: "50"

Apisix-Ingress-Controller报错信息:导致现有的ApisixRoute出现不同步更新,新增ApisixRoute也中断

W0224 10:31:34.762438       1 reflector.go:424] pkg/mod/k8s.io/client-go@v0.25.4/tools/cache/reflector.go:169: failed to list *v2.ApisixRoute: time: missing unit in duration "50"
E0224 10:31:34.762468       1 reflector.go:140] pkg/mod/k8s.io/client-go@v0.25.4/tools/cache/reflector.go:169: Failed to watch *v2.ApisixRoute: failed to list *v2.ApisixRoute: time: missing unit in duration "50"

正确示例使用ApisixUpstreams

apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: nginx # service的名字 
spec:
  timeout:
    connect: 20s
    read: 20s
    send: 20s

验证结果

{ "nodes": [{ "host": "10.244.0.142", "port": 80, "weight": 100 }], "timeout": { "connect": 20, "send": 20, "read": 20 }, "type": "roundrobin", "hash_on": "vars", "scheme": "http", "pass_host": "pass", "name": "default_nginx_80", "desc": "Created by apisix-ingress-controller, DO NOT modify it manually", "labels": { "managed-by": "apisix-ingress-controller" } }