Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: After installing ingress-controller and crd, the controller log prompts the error "failed to list routes in APISIX" #2295

Closed
ColeSu-n opened this issue Sep 12, 2024 · 4 comments

Comments

@ColeSu-n
Copy link

ColeSu-n commented Sep 12, 2024

Issue description

The k8 cluster I am in has already installed dashboard and apisix. I want to install ingress-controller and crd on this basis.

2024-09-12T10:40:52+08:00	debug	apisix/cluster.go:698	list resource in cluster	{"cluster_name": "default", "name": "upstream", "url": "http://apisix-admin.infra:9180/apisix/admin/upstreams"}
2024-09-12T10:40:52+08:00	debug	apisix/ssl.go:89	try to list ssl in APISIX	{"url": "http://apisix-admin.infra:9180/apisix/admin/ssl", "cluster": "default"}
2024-09-12T10:40:52+08:00	debug	apisix/cluster.go:698	list resource in cluster	{"cluster_name": "default", "name": "ssl", "url": "http://apisix-admin.infra:9180/apisix/admin/ssl"}
2024-09-12T10:40:52+08:00	error	apisix/ssl.go:96	**failed to list ssl**: unexpected status code 404; error message: {"error_msg":"Unsupported resource type: ssl"}

2024-09-12T10:40:52+08:00	error	apisix/cluster.go:308	**failed to list ssl** in APISIX: unexpected status code 404; error message: {"error_msg":"Unsupported resource type: ssl"}

2024-09-12T10:40:52+08:00	error	apisix/cluster.go:258	**failed to sync cache**	{"cost_time": "8.092201915s", "cluster": "default"}
2024-09-12T10:40:52+08:00	error	providers/controller.go:421	**failed to wait the default cluster to be ready**: unexpected status code 404; error message: {"error_msg":"Unsupported resource type: ssl"}

2024-09-12T10:40:52+08:00	debug	apisix/cluster.go:698	list resource in cluster	{"cluster_name": "default", "name": "streamRoute", "url": "http://apisix-admin.infra:9180/apisix/admin/stream_routes"}
2024-09-12T10:40:52+08:00	info	apisix/stream_route.go:38	resource stream_routes is disabled
2024-09-12T10:40:52+08:00	info	apisix/cluster.go:463	syncing schema	{"cluster": "default"}
2024-09-12T10:40:52+08:00	info	apisix/cluster.go:248	syncing cache	{"cluster": "default"}
2024-09-12T10:40:52+08:00	debug	apisix/plugin.go:40	try to list plugins' names in APISIX	{"cluster": "default", "url": "http://apisix-admin.infra:9180/apisix/admin/plugins"}
2024-09-12T10:40:52+08:00	debug	apisix/route.go:84	try to list routes in APISIX	{"cluster": "default", "url": "http://apisix-admin.infra:9180/apisix/admin/routes"}
2024-09-12T10:40:52+08:00	debug	apisix/cluster.go:698	list resource in cluster	{"cluster_name": "default", "name": "route", "url": "http://apisix-admin.infra:9180/apisix/admin/routes"}
2024-09-12T10:40:52+08:00	error	apisix/route.go:90	failed to list routes: Get "http://apisix-admin.infra:9180/apisix/admin/routes": context canceled
2024-09-12T10:40:52+08:00	error	apisix/cluster.go:298	**failed to list routes in APISIX**: Get "http://apisix-admin.infra:9180/apisix/admin/routes": context canceled
2024-09-12T10:40:52+08:00	error	apisix/cluster.go:258	**failed to sync cache**	{"cost_time": "190.3?s", "cluster": "default"}
2024-09-12T10:40:52+08:00	error	apisix/plugin.go:46	failed to list plugins' names: Get "http://apisix-admin.infra:9180/apisix/admin/plugins?all=true": context canceled
2024-09-12T10:40:52+08:00	error	apisix/cluster.go:483	failed to list plugin names in APISIX: Get "http://apisix-admin.infra:9180/apisix/admin/plugins?all=true": context canceled
2024-09-12T10:40:52+08:00	error	apisix/cluster.go:446	failed to sync schema: Get "http://apisix-admin.infra:9180/apisix/admin/plugins?all=true": context canceled
2024-09-12T10:41:01+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 103.777?s
2024-09-12T10:41:01+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 76.567?s
2024-09-12T10:41:11+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 63.716?s
2024-09-12T10:41:11+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 54.824?s
2024-09-12T10:41:21+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 80.695?s
2024-09-12T10:41:21+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 95.598?s
2024-09-12T10:41:31+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 46.811?s
2024-09-12T10:41:31+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 62.549?s
2024-09-12T10:41:41+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 77.713?s
2024-09-12T10:41:41+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 66.077?s
2024-09-12T10:41:51+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 109.4?s
2024-09-12T10:41:51+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 63.481?s
2024-09-12T10:42:01+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 50.37?s
2024-09-12T10:42:01+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 28.198?s
2024-09-12T10:42:11+08:00	debug	log/gin_logger.go:41	path: /healthz, status: 200, method: GET, query: , ip: 192.168.81.57, user-agent: kube-probe/1.24, errors: , cost: 60.766?s

I want to know if there is something wrong with my installation steps and how to troubleshoot it?
And after I created an apisixroute, I obtained all the routes through the apisix api and found that there was no routing information in the apisixroute I just created.

Environment

apisix:3.7-debian
apisix-ingress-controller:1.8.0

cm

data:
  config.yaml: |
    log_level: "debug"
    log_output: "stderr"
    http_listen: ":8080"
    enable_profiling: true
    kubernetes:
      kubeconfig: ""
      resync_interval: "30s"
      namespace_selector:
      - ""
      ingress_class: "apisix"
      ingress_version: "networking/v1"
      apisix_route_version: "apisix.apache.org/v2"
    apisix:
      default_cluster_base_url: "http://apisix-admin.infra:9180/apisix/admin"
      default_cluster_admin_key: "edd1c9f034335f136f87ad84b625c8f1"
kind: ConfigMap
metadata:
  name: apisix-ingress-conf
  namespace: infra
  labels:
    app.kubernetes.io/name: ingress-controller

ingress-deployment

kind: Deployment
metadata:
  name: apisix-ingress-controller
  namespace: infra
  labels:
    app.kubernetes.io/name: ingress-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: ingress-controller
  template:
    metadata:
      labels:
        app.kubernetes.io/name: ingress-controller
    spec:
      serviceAccountName: apisix-ingress-controller
      volumes:
        - name: configuration
          configMap:
            name: apisix-ingress-conf
            items:
              - key: config.yaml
                path: config.yaml
      initContainers:
        - name: wait-apisix-admin
          image: busybox:1.28
          command: ['sh', '-c', "until nc -z apisix-admin.infra.svc.cluster.local 9180 ; do echo waiting for apisix-admin; sleep 2; done;"]
      containers:
        - name: ingress-controller
          command:
            - /ingress-apisix/apisix-ingress-controller
            - ingress
            - --config-path
            - /ingress-apisix/conf/config.yaml
          image: "apache/apisix-ingress-controller:1.8.0"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
          resources:
            {}
          volumeMounts:
            - mountPath: /ingress-apisix/conf
              name: configuration
@ColeSu-n
Copy link
Author

ColeSu-n commented Sep 12, 2024

resolve

apiVersion: v1
data:
  config.yaml: |
    log_level: "debug"
    log_output: "stderr"
    http_listen: ":8080"
    enable_profiling: true
    kubernetes:
      kubeconfig: ""
      resync_interval: "30s"
      namespace_selector:
      - ""
      ingress_class: "apisix"
      ingress_version: "networking/v1"
      apisix_route_version: "apisix.apache.org/v2"
    apisix:
      default_cluster_base_url: " "http://apisix-admin.infra:9180/apisix/admin"
      admin_api_version: "v3"
      default_cluster_admin_key: "edd1c9f034335f136f87ad84b625c8f1"
kind: ConfigMap
metadata:
  name: apisix-ingress-conf
  namespace: infra
  labels:
    app.kubernetes.io/name: ingress-controller

@sereneshikari
Copy link

Hey @SsLaLal, did you close this because you found out the problem? If so, could you please share details? It would be really helpful, thanks!

@ColeSu-n
Copy link
Author

ColeSu-n commented Dec 23, 2024

Hey @SsLaLal, did you close this because you found out the problem? If so, could you please share details? It would be really helpful, thanks!
@sereneshikari
Routes for apisix are stored in etcd. If the log indicates that the route cannot be found, you can check whether the etcd cluster is healthy or view the etcd cluster log. This is because when I configured etcd of apisix, I found that the data directory stored in etcd's own storage volume was not correct. Later I rebuilt the etcd environment and everything was fine.

@sereneshikari
Copy link

Great, thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants