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: stream_proxy(mqtt_proxy) do not support dns resolv。 #3964

Closed
souzens opened this issue Apr 1, 2021 · 3 comments · Fixed by #4391
Closed

Request help: stream_proxy(mqtt_proxy) do not support dns resolv。 #3964

souzens opened this issue Apr 1, 2021 · 3 comments · Fixed by #4391

Comments

@souzens
Copy link

souzens commented Apr 1, 2021

Issue description

Background:
This is the requirement for developer in our company. It is necessary to deploy the mqtt service inside the k8s cluster with container, the conventional practice in the past is to create loadbalancer service to expose nodeport, but it is troublesome for operation and maintenance. The current api entry is unified by apisix, and apisix also has mqtt_proxy plugin, so just to try it.

During the deployment process, many problems were encountered.

FIrst question:
Apply the plugin of mqtt_proxy to the route through the apisix-dashboard, but it does not actually take effect

./etcdctl --endpoints=10.111.9.154:2379 get /apisix/routes/348239466273440537 --prefix
/apisix/routes/348239466273440537

{"id":"348239466273440537","create_time":1617096496,"update_time":1617255551,"uris":["/*"],"name":"mqtt_test","desc":"xxxxx","methods":["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],"hosts":["mqtttest.test.com"],"vars":[],"plugins":{"mqtt-proxy":{"disable":false,"protocol_level":4,"protocol_name":"MQTT","upstream":{"ip":"172.20.250.158","port":1883}}},"upstream":{"nodes":[{"host":"mqtt.test.svc.cluster.local","port":8080,"weight":1}],"timeout":{"connect":6000,"read":6000,"send":6000},"type":"roundrobin","pass_host":"pass"},"labels":{"domain":"test.com"},"status":1}

Second question:
Add stream_route through api, the ip field of upstream does not support domain name, ip must be used
In view of this problem, it is not convenient to use it in k8s. It is well known that the service domain name can be used for calls within the cluster.

./etcdctl --endpoints=10.111.9.154:2379 get /apisix/stream_routes --prefix
/apisix/stream_routes/1
{"id":"1","plugins":{"mqtt-proxy":{"upstream":{"ip":"mqtt.test.svc.cluster.local","port":1883},"protocol_name":"MQTT","protocol_level":4}}}

apisix error_log

2021/04/01 13:27:50 [warn] 2760#2760: *168 stream [lua] upstream.lua:193: set_upstream(): upstream node has been specified, cannot be set repeatedly while prereading client data, client: 10.254.6.185, server: 0.0.0.0:9100
2021/04/01 13:27:50 [error] 2760#2760: *168 stream [lua] balancer.lua:208: load_balancer(): failed to set server peer [mqtt.test.com:1883] err: no host allowed while connecting to upstream, client: 10.254.6.185, server: 0.0.0.0:9100, bytes from/to client:0/0, bytes from/to upstream:0/0

Environment

  • apisix version (cmd: apisix version): 2.4
  • OS (cmd: uname -a): centos & k8s
@Firstsawyou
Copy link
Contributor

Firstsawyou commented Apr 1, 2021

Regarding the first question, currently apisix-dashboard does not support the mqtt_proxy plug-in configuration of stream. Because it is a configuration for the seven-layer traffic.

The second question, maybe we need to support the configuration of the domain name.

@tokers
Copy link
Contributor

tokers commented Apr 1, 2021

@souzens Yep, the current apisix-dashboard isn't capable to configure plugins for stream routes, you may have to configure them by invoking APIs by yourselves.

And I think the second one can be supported. cc @spacewander @membphis

@membphis
Copy link
Member

membphis commented Apr 5, 2021

welcome PR @souzens

spacewander added a commit to spacewander/incubator-apisix that referenced this issue Jun 8, 2021
Fix apache#3964

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
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

Successfully merging a pull request may close this issue.

4 participants