apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.5k stars 2.52k forks source link

help request: APISIX 3.8 and Consul Integration #10958

Open KalepuHarish opened 8 months ago

KalepuHarish commented 8 months ago

Description

Hi am using Consul as service discovery and spring cloud gateway and it register as service in consul now i want migrate to apisix and i am using it apisix-docker 3.8 but i am unable to make connection between consul and apisix.

can someone please help and if any source or steps please help me

Environment

theweakgod commented 8 months ago

Hello, perhaps what you need is this: consul.md

kayx23 commented 8 months ago

i am using it apisix-docker 3.8 but i am unable to make connection between consul and apisix

Please see: https://docs.api7.ai/apisix/how-to-guide/service-discovery/consul-integration

As it sounds like a connectivity issue, if you can share how you started APISIX and Consul, as well as your configurations, that would be very helpful to help suggest the next step.

KalepuHarish commented 8 months ago

Hi @kayx23,

Thank you for response and to your point below is the way i am staring APISIX and Consul.

1. i am using apisix-docker and using docker compose i am starting apisix below is the compose file config.yaml file docker-compose.yaml file:

version: "3"

services: apisix-dashboard: image: apache/apisix-dashboard:3.0.1-alpine restart: always volumes:

networks: apisix: driver: bridge

volumes: etcd_data: driver: local

config.yaml file

discovery: consul: servers:

deployment: admin: allow_admin: # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow

plugin_attr: prometheus: export_addr: ip: "0.0.0.0" port: 9091

2. Running consul using brew install in my macbook and its running on 8500 port with UI. using below commands

brew tap hashicorp/tap brew install hashicorp/tap/consul

And also i tried another way i.e

  1. Running APISIX on AWS EC2 instance with same config using docker only
  2. Running Consul on Another EC2 Instance in this case also i am unable to make connection between them. below is the doc using to install consul: https://developer.hashicorp.com/consul/install

Thanks, Harish

theweakgod commented 8 months ago

discovery: consul: servers:

Use Networks Gateway.

KalepuHarish commented 8 months ago

@kayx23 But i am not running consul using docker. but could you give little detailed answer with example please that will help a lot please.

kayx23 commented 8 months ago

discovery: consul: servers:

Replace 127.0.0.1 with your host's private ip address:

image

KalepuHarish commented 8 months ago

@kayx23 thank you so much will try and let you know

KalepuHarish commented 8 months ago

but what if i am doing like below:

1. Running APISIX on AWS EC2 instance with same config using docker only
2. Running Consul on Another EC2 Instance in this case also i am unable to make connection between them.
below is the doc using to install consul: https://developer.hashicorp.com/consul/install
kayx23 commented 8 months ago
  1. similar to what I mentioned above, replace 127.0.0.1 with your EC2 host's private ip address.
  2. you would have to research a bit more on your own to configure out how to adjust the networking and security group setups.
KalepuHarish commented 8 months ago
Screenshot 2024-02-23 at 1 05 10 PM

as you suggested followed same but if you attached screenshot still its not able to connect to consul

theweakgod commented 8 months ago

docker inspect apisix container, and use NETWORKS GATEWAY as ur consul host.

kayx23 commented 8 months ago

as you suggested followed same but if you attached screenshot still its not able to connect to consul

@KalepuHarish I cannot reproduce your issue unfortunately.

Any update? Still struggling with the same?