错误示范

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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也中断

1
2
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

1
2
3
4
5
6
7
8
9
apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: nginx # service的名字 
spec:
  timeout:
    connect: 20s
    read: 20s
    send: 20s

验证结果

1
{ "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" } }