Skip to content

Set discovery to DNS, and the service port cannot be obtained automatically  #4986

Description

@fuguanye

Issue description

服务发现使用为DNS后,添加路由时,服务名称一定要带端口号吗,测试发现不带端口都被转发到80端口上去了
config.yaml:
discovery:
dns:
servers:
- "127.0.0.1:8600" # use the real address of your dns server
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"uri": "/gatewayd/",
"upstream": {
"service_name": "gateway.service.consul"
"type": "roundrobin",
"discovery_type": "dns"
},
"plugins": {
"proxy-rewrite" : {
"regex_uri": ["^/gatewayd/(.
)", "/${1}"]
}
}
}'

G}54OW9QEESI L5M}1H`G05
@9%8JW L44 @V{B(6V7 BNU
而实际环境中一个服务对应多个节点,端口都是随机不一致的
不能自动获取consul 上注册上去的端口么

Environment

  • apisix version (cmd: apisix version): 2.9
  • OS (cmd: uname -a): centos 7 Linux localhost.localdomain 3.10.0-1160.el7.x86_64 change: added doc of how to load plugin. #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):openresty/1.19.9.1
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):3.5.0
  • apisix-dashboard version, if have:2.7
  • consul version :V1.10.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions