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

bug: ApisixUpstream not created for a kubernetes service using discovery type kubernetes #2200

Closed
singhajitk opened this issue Apr 4, 2024 · 6 comments

Comments

@singhajitk
Copy link

Current Behavior

Hi @shreemaan-abhishek, @h When Upstream creates through Apisix dashboard by selecting Upstream Type: Service Discovery and it has below spec as yaml

type: roundrobin
hash_on: vars
scheme: https
discovery_type: kubernetes
pass_host: node
name: api-testapp
service_name: apisix/api-test:http

But it gave error "reason: ResourceSyncAborted" when creating using below manifest file

apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: api-test-upstream
  namespace: apisix
spec:
  scheme: https
  loadbalancer:
    type: roundrobin
  discovery:
    serviceName: apisix/api-test:http
    type: kubernetes
  passHost: pass

Expected Behavior

ApisixUpstream should get created and have status as

status:
  conditions:
    - lastTransitionTime: 'TimeStamp'
      message: Sync Successfully
      observedGeneration: 1
      reason: ResourcesSynced
      status: 'True'
      type: ResourcesAvailable

Error Logs

apisix-ingress-controller throw below error:

2024-04-04T08:16:14+08:00 error apisix/apisix_upstream.go:333 failed to get upstream apisix_api-test-upstream: not found
2024-04-04T08:16:14+08:00 warn apisix/apisix_upstream.go:489 sync ApisixUpstream failed, will retry {"object": {"Type":1,"Object":{"Key":"apisix/api-test-upstream","OldObject":null,"GroupVersion":"apisix.apache.org/v2"},"OldObject":null,"Tombstone":null}, "error": "not found"}
2024-04-04T08:16:49+08:00 warn apisix/cluster.go:1164 upstream not found {"id": "2a212dd9", "url": "http://apisix-admin.apisix.svc.cluster.local:9180/apisix/admin/upstreams/2a212dd9", "cluster": "default"}

Steps to Reproduce

  1. Install APISIX, APISIX ingress controller and APISIX dashboard with the helm chart.
  2. Create a ApisixUpstream with below template
apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: api-test-upstream
  namespace: apisix
spec:
  scheme: https
  loadbalancer:
    type: roundrobin
  discovery:
    serviceName: apisix/api-test:http
    type: kubernetes
  passHost: pass
  1. Verify the created resource in cluster

Environment

APISIX version : - 3.8.0
Operating system : Linux apisix-647b4867df-79542 5.4.0-136-generic test: only check part of schema. apache/apisix#153 SMP Wed Nov 30 15:47:57 UTC 2022 x86_64 GNU/Linux
OpenResty / Nginx version (run openresty -V or nginx -V):
nginx version: openresty/1.21.4.2
built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
built with OpenSSL 3.2.0 23 Nov 2023
TLS SNI support enabled

APISIX Dashboard version: 3.0.0

APISIX ingress controller version: 1.8.0

@Revolyssup
Copy link
Contributor

@singhajitk You need to have an associated ApisixRoute which references this upstream.

@Revolyssup
Copy link
Contributor

@singhajitk Btw it is not recommended to use ingress controller with apisix dashboard

@singhajitk
Copy link
Author

@singhajitk You need to have an associated ApisixRoute which references this upstream.

Thanks @Revolyssup for looking into this issue. As per my understanding ApisixUpstream has to be created first which can be then referenced by ApisixRoute. I am facing issue for resource not found while creating the ApisixUpstream resouirce. The ingress controller pod log says that resource not found and not able to sync.

@singhajitk
Copy link
Author

@singhajitk Btw it is not recommended to use ingress controller with apisix dashboard

@Revolyssup, I give example of Route and Upstream configuration from Dashboard for better explaining of the issue. I am trying to use ingress controller and create ApisixUpstream and ApisixRoute resource using yaml manifest files

@Revolyssup
Copy link
Contributor

@singhajitk You need to have an associated ApisixRoute which references this upstream.

Thanks @Revolyssup for looking into this issue. As per my understanding ApisixUpstream has to be created first which can be then referenced by ApisixRoute. I am facing issue for resource not found while creating the ApisixUpstream resouirce. The ingress controller pod log says that resource not found and not able to sync.

Yes it says that but when you will create a route referencing the upstream, the upstream will be created.

@singhajitk
Copy link
Author

@singhajitk You need to have an associated ApisixRoute which references this upstream.

Thanks @Revolyssup for looking into this issue. As per my understanding ApisixUpstream has to be created first which can be then referenced by ApisixRoute. I am facing issue for resource not found while creating the ApisixUpstream resouirce. The ingress controller pod log says that resource not found and not able to sync.

Yes it says that but when you will create a route referencing the upstream, the upstream will be created.

Got it. Thank you @Revolyssup

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