You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "unreal-altran (via GitHub)" <gi...@apache.org> on 2023/03/07 14:22:46 UTC

[GitHub] [apisix] unreal-altran opened a new issue, #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

unreal-altran opened a new issue, #9033:
URL: https://github.com/apache/apisix/issues/9033

   ### Current Behavior
   
   The bug is linked to the same enviroment/context describe in this [issue](https://github.com/apache/apisix/issues/9032) 
   
   
   For all versions of consult with which the integration works properly:
   
   consul:1.8 ok 
   consul:1.10 ok
   consul:1.11 ok
   consul:1.12 ok
   consul:1.13 ok
   consul:1.14 oK
   
   if a consul service is added with DNS names instead of IPs, APISix while correctly retrieving the service from consul discovery, fails in the creating the upstream. Everything works fine if you only use IP addresses.
   
   ```
   # Register with the corresponding IP and port --> works well on ApiSix
   curl --location --request PUT 'http://127.0.0.1:8500/v1/agent/service/register' \
     --header 'Content-Type: application/json' \
     --data '{
         "ID": "service_a1",
         "Name": "service_a",
        "Tags": ["primary", "v1"],
        "Address": "172.21.0.5",
        "Port": 9081,
        "Weights": {
            "Passing": 10,
            "Warning": 1
        }
     }'
   ```
   
   # Register with the corresponding DNS and port not works on ApiSix
   curl --location --request PUT 'http://127.0.0.1:8500/v1/agent/service/register' \
     --header 'Content-Type: application/json' \
     --data '{
         "ID": "service_a1",
         "Name": "service_a",
        "Tags": ["primary", "v1"],
        "Address": "myservice.mysubdomain.com",
        "Port": 9081,
        "Weights": {
            "Passing": 10,
            "Warning": 1
        }
     }'
   
   
   
   ### Expected Behavior
   
   That the consul discovery works well and then:
   
   the first request
   curl -s http://127.0.0.1:9080/consul/web/
   Output
   hello web2%
   
   the second request
   curl -s http://127.0.0.1:9080/consul/web/
   Output
   hello web1%
   
   ### Error Logs
   
   2023/03/07 08:16:22 [error] 68#68: *50298 [lua] balancer.lua:388: run(): failed to set server peer [myservice.mysubdomain.com:9081] err: no host allowed while connecting to upstream, client: 100.64.0.7, server: _, request: "GET /consul/web/ HTTP/1.1", host: "apisix-gateway.apps.lab.okd.devops.com:30732"
   
   ### Steps to Reproduce
   
   The same step in this [guide](https://apisix.apache.org/blog/2023/01/18/consul-with-apisix/) with docker or installation with helm on k8s (same behaviour).
   Use all DNS name instead IP address.
   
   ### Environment
   
   Environment
   APISIX 3.2
   Consul 1.8 to 1.14.x
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Fabriceli commented on issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

Posted by "Fabriceli (via GitHub)" <gi...@apache.org>.
Fabriceli commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1465106208

   I check it later


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1463096960

   I know a little about Consul, it seems you can use Consul's DNS interface to combine them?
   https://developer.hashicorp.com/consul/docs/discovery/dns


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1459126484

   APISIX currently only supports one-level upstream IP discovery - either via DNS or via service discovery. We have discussed this before, but adding a new level will make the code complex.
   As the service discovery is used, what about configuring the IP directly? Is there a strong reason to use DNS name instead of IP?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] unreal-altran commented on issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

Posted by "unreal-altran (via GitHub)" <gi...@apache.org>.
unreal-altran commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1459934423

   The situations in which it can be useful are mainly linked to the insertion of an indirection level through a DNS name which can carry out failover, balancing, geographical position etc... for example towards legacy services.
   In these cases it could be solved (in part) by using an ApiSix DNS discovery type, but the sum of the Consul + DNS resolution would be even more powerful. 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name [apisix]

Posted by "xiak (via GitHub)" <gi...@apache.org>.
xiak commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-2826198200

   any update?
   
   if APISIX and consul in one docker compose network, they can use service name to visit each other.
   
   But 502 
   
   2025-04-24 11:14:25 2025/04/24 03:14:25 [error] 72#72: *391603 [lua] balancer.lua:388: run(): failed to set server peer [:8080] err: no host while connecting to upstream, client: 172.31.0.1, server: _, request: "GET /sw-ui HTTP/1.1", host: "127.0.0.1:9080"
   2025-04-24 11:14:26 172.31.0.14 - - [24/Apr/2025:03:14:23 +0000] apisix:9080 "GET /-/health HTTP/1.1" 200 13 0.000 "-" "Consul Health Check" - - - "http://apisix:9080"
   2025-04-24 11:14:28 172.31.0.1 - - [24/Apr/2025:03:14:25 +0000] 127.0.0.1:9080 "GET /sw-ui HTTP/1.1" 502 631 0.000 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"  - 0.000 "http://127.0.0.1:9080/sw-ui"
   
   consul config:
           {
             "name": "sw-ui",
             "port": 8080,
             "check": {
               "http": "http://sw-ui:8080/config.json",
               "interval": "10s"
             }
           },
   
   docker compose config
     sw-ui:
       image: ${SW_UI_IMAGE}
       networks:
         - ads
       ports:
         - "${SW_UI_PORT}:8080"
       depends_on:
         sw-oap:
           condition: service_healthy
       environment:
         SW_OAP_ADDRESS: http://sw-oap:12800
         SW_CONSUL_ADDRESS: http://consul:8500
         SW_CONSUL_ENDPOINT: /v1/kv/ads/skywalking/ui/config.json?raw
   
     consul:
       image: ${CONSUL_IMAGE}
       container_name: consul
       environment:
         CONSUL_LOCAL_CONFIG: |
           {
             "verify_incoming": false,
             "verify_outgoing": false
           }
       command: agent -server -bootstrap-expect=1 -data-dir=/consul/data -ui -bind=0.0.0.0 -client=0.0.0.0
       ports:
         - "${CONSUL_PORT}:8500"
       expose:
         - "8300"  # RPC
         - "8301"  # Serf LAN
         - "8302"  # Serf WAN(可选)
   
         - "8600"  # DNS
       volumes:
         - ./discovery/data:/consul/data
       networks:
         - ads
     apisix:
       image: apache/apisix:3.12.0-debian
       restart: always
       volumes:
         - ./gateway/apisix/config.yaml:/usr/local/apisix/conf/config.yaml:ro
       depends_on:
         - etcd
       ##network_mode: host
       # 外部网络
       ports:
         - "${APISIX_ADMIN_PORT}:9180/tcp"
         - "${APISIX_PORT}:9080"
         # - "9091:9091/tcp"
         # - "9443:9443"
         # - "9092:9092/tcp"
       expose:
         - "9081"
         - "9091"
         - "9443"
         - "9092"
       networks:
         - ads


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1962879951

   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name
URL: https://github.com/apache/apisix/issues/9033


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1988072919

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] unreal-altran commented on issue #9033: bug: ApisSix 3.2 Consul 1.8 to 1.14.x Integration problem with services DNS name

Posted by "unreal-altran (via GitHub)" <gi...@apache.org>.
unreal-altran commented on issue #9033:
URL: https://github.com/apache/apisix/issues/9033#issuecomment-1463588298

   Yes, with Consul it is possible to set up a Service Lookups based on DNS, in fact in the previous post I wrote to use APiSix with DNS discovery which uses the DNS consul but the interaction and the solution is quite different from the mode requested in this issue. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org