Skip to content

bug: When etcdserver=true, newly added ApisixRoutes don't take effect after restarting the ingress-controller  #2341

@lkad

Description

@lkad

Current Behavior

like #2167 ,i install apsix ingress-controller use etcdserver=true https://apisix.apache.org/blog/2023/10/18/ingress-apisix/#design-of-new-architecture ,but somtime ingress-controller can restart ,then i add route or change rout in apisixroute ,it not effect .
install apisix :
ADMIN_API_VERSION=v3
helm install apisix .
--set service.type=NodePort
--set ingress-controller.enabled=true
--create-namespace
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
--set ingress-controller.config.apisix.adminAPIVersion=$ADMIN_API_VERSION
--set ingress-controller.config.kubernetes.enableGatewayAPI=true
--set dashboard.enabled=true
--set ingress-controller.config.etcdserver.enabled=true
then add apisixroute

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: test-route
  namespace: testroute2
spec:
  http:
    - name: route-1
      match:
        hosts:
          - routetest2cccc.ccc.ccc
        paths:
          - /*
      backends:
        - serviceName: httpbin
          servicePort: 80
kind: Deployment
apiVersion: apps/v1
metadata:
  name: httpbin
  namespace: testroute2
  labels:
    app: httpbin
  annotations:
    deployment.kubernetes.io/revision: '1'
    kubesphere.io/creator: admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpbin
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: httpbin
      annotations:
        kubesphere.io/creator: admin
        kubesphere.io/imagepullsecrets: '{}'
        kubesphere.io/restartedAt: '2024-11-28T00:57:38.581Z'
    spec:
      containers:
        - name: container-cjo9a0
          image: mccutchen/go-httpbin
          ports:
            - name: http-0
              containerPort: 80
              protocol: TCP
          env:
            - name: PORT
              value: '80'
          resources:
            limits:
              cpu: '2'
              memory: 1000Mi
            requests:
              cpu: 200m
              memory: 200Mi
          readinessProbe:
            httpGet:
              path: /
              port: 80
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
kind: Service
apiVersion: v1
metadata:
  name: httpbin
  namespace: testroute2
  labels:
    app: httpbin
  annotations:
    kubesphere.io/creator: admin
spec:
  ports:
    - name: http-1
      protocol: TCP
      port: 80
      targetPort: 80
  selector:
    app: httpbin
  type: ClusterIP
  sessionAffinity: None
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster

please add more other apisixroute
then curl ip/get -H "host: routetest2cccc.ccc.ccc" .return 200.
then find the ingress on which k8s node ,on the k8s node exec shell kill the ingress-controller
" ps -elf | grep ingress-controller | awk '{print $4}' | xargs kill "
then change the apisixroute

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: test-route
  namespace: testroute2
spec:
  http:
    - name: route-1
      match:
        hosts:
          - routenew.ccc.ccc
        paths:
          - /*
      backends:
        - serviceName: httpbin
          servicePort: 80

curl ip/get -H "host: routenew.ccc.ccc" .return 404.

Expected Behavior

curl ip/get -H "host: routenew.ccc.ccc" .return 200.

Error Logs

apisix contoianer log
2024/12/26 06:07:13 [error] 59#59: *3033128 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:13 [error] 51#51: *3033129 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:13 [error] 56#56: *3033130 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:13 [error] 54#54: *3033131 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 49#49: *3033267 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 52#52: *3033268 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 55#55: *3033269 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 53#53: *3033270 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 59#59: *3033271 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 50#50: *3033272 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 56#56: *3033273 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 51#51: *3033274 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:16 [error] 54#54: *3033275 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 49#49: *3033413 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 52#52: *3033414 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 53#53: *3033415 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 55#55: *3033416 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 59#59: *3033417 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 50#50: *3033418 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 56#56: *3033419 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 51#51: *3033420 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

2024/12/26 06:07:19 [error] 54#54: *3033421 [lua] config_etcd.lua:193: watchdir err: has no healthy etcd endpoint available, context: ngx.timer

Steps to Reproduce

like #2167 ,i install apsix ingress-controller use etcdserver=true,but somtime ingress-controller can restart ,then i add route or change rout in apisixroute ,it not effect .
install apisix :
ADMIN_API_VERSION=v3
helm install apisix .
--set service.type=NodePort
--set ingress-controller.enabled=true
--create-namespace
--namespace ingress-apisix
--set ingress-controller.config.apisix.serviceNamespace=ingress-apisix
--set ingress-controller.config.apisix.adminAPIVersion=$ADMIN_API_VERSION
--set ingress-controller.config.kubernetes.enableGatewayAPI=true
--set dashboard.enabled=true
--set ingress-controller.config.etcdserver.enabled=true
then add apisixroute

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: test-route
  namespace: testroute2
spec:
  http:
    - name: route-1
      match:
        hosts:
          - routetest2cccc.ccc.ccc
        paths:
          - /*
      backends:
        - serviceName: httpbin
          servicePort: 80
kind: Deployment
apiVersion: apps/v1
metadata:
  name: httpbin
  namespace: testroute2
  labels:
    app: httpbin
  annotations:
    deployment.kubernetes.io/revision: '1'
    kubesphere.io/creator: admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpbin
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: httpbin
      annotations:
        kubesphere.io/creator: admin
        kubesphere.io/imagepullsecrets: '{}'
        kubesphere.io/restartedAt: '2024-11-28T00:57:38.581Z'
    spec:
      containers:
        - name: container-cjo9a0
          image: mccutchen/go-httpbin
          ports:
            - name: http-0
              containerPort: 80
              protocol: TCP
          env:
            - name: PORT
              value: '80'
          resources:
            limits:
              cpu: '2'
              memory: 1000Mi
            requests:
              cpu: 200m
              memory: 200Mi
          readinessProbe:
            httpGet:
              path: /
              port: 80
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
kind: Service
apiVersion: v1
metadata:
  name: httpbin
  namespace: testroute2
  labels:
    app: httpbin
  annotations:
    kubesphere.io/creator: admin
spec:
  ports:
    - name: http-1
      protocol: TCP
      port: 80
      targetPort: 80
  selector:
    app: httpbin
  type: ClusterIP
  sessionAffinity: None
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster

please add more other apisixroute
then curl ip/get -H "host: routetest2cccc.ccc.ccc" .return 200.
then find the ingress on which node ,one the node exec shell kill the ingress-controller
" ps -elf | grep ingress-controller | awk '{print $4}' | xargs kill "
then change the apisixroute

apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: test-route
  namespace: testroute2
spec:
  http:
    - name: route-1
      match:
        hosts:
          - routenew.ccc.ccc
        paths:
          - /*
      backends:
        - serviceName: httpbin
          servicePort: 80

curl ip/get -H "host: routenew.ccc.ccc" .return 404.

Environment

  • APISIX Ingress controller version (run apisix-ingress-controller version --long)
    apache/apisix-ingress-controller:1.8.0
  • Kubernetes cluster version (run kubectl version)
    Client Version: v1.29.2
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.28.8
  • OS version if running APISIX Ingress controller in a bare-metal environment (run uname -a)
    apache/apisix:3.8.1-debian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions