emqx icon indicating copy to clipboard operation
emqx copied to clipboard

Helm Chart: MQTT ingress proxies HTTP to MQTT port

Open Altair-Bueno opened this issue 1 year ago • 2 comments

What happened?

Setting ingress.mqtt forwards to MQTT port

What did you expect to happen?

ingress.mqtt should create an ingress that points to service.ws. After all, ingress is designed for HTTP/WS, not TCP

How can we reproduce it (as minimally and precisely as possible)?

# values.yaml
ingress:
  mqtt:
    enabled: true

Anything else we need to know?

This is the culprit: https://github.com/emqx/emqx/blob/f969a4ef5ea79d4e79a1cbbd131b709091b80cf7/deploy/charts/emqx/templates/ingress.yaml#L89

EMQX version

Chart 5.5.0

OS version

No response

Log files

No response

Altair-Bueno avatar Jun 20 '24 12:06 Altair-Bueno

You are correct in noting that Kubernetes Ingress is primarily designed for HTTP and HTTPS traffic, utilizing protocols like HTTP, HTTPS, and WebSockets (WS). Since Ingress operates at the application layer (Layer 7), it is well-suited for handling HTTP-based protocols which allow for routing based on URL paths.

For MQTT, which typically operates over TCP (not HTTP), using a standard Ingress controller wouldn't be suitable as it does not handle TCP services. However, some specialized Ingress controllers, like NGINX or HAProxy, can be configured to handle non-HTTP traffic including TCP and UDP, thus enabling the routing capabilities for MQTT traffic as well.

zmstone avatar Jun 23 '24 09:06 zmstone

Still, thats non standard behavior. There is a reason why work is being done on the Gateway api.

Nonetheless your comment rises the following question: why the chart doesn't provide an ingress.ws value, which would be standard behavior? It could be preset with the path pointing to /mqtt, that way you could set both dashboard and ws to the same host without messing routing.

Altair-Bueno avatar Jun 23 '24 10:06 Altair-Bueno

why the chart doesn't provide an ingress.ws value, which would be standard behavior? It could be preset with the path pointing to /mqtt, that way you could set both dashboard and ws to the same host without messing routing.

@Altair-Bueno It's a great idea. could you please creaete a PR for this?

Rory-Z avatar Jul 02 '24 01:07 Rory-Z

@Rory-Z Something like https://github.com/emqx/emqx/pull/13411? It works on my end, but Im unaware of any Helm tests or other requisites you may have related to the chart

Altair-Bueno avatar Jul 04 '24 07:07 Altair-Bueno