Access the MQTT Broker Outside the Cluster

This page describes how to access the MQTT Broker from outside the cluster.

By default the MQTT Broker is only available from within the cluster, therefore you cannot access it from external applications.

You can enable external access from the MQTT Broker configuration.

Before you begin

You need to have a UMH cluster. If you do not already have a cluster, you can create one by using the Management Console .

Enable external access from MQTT Broker configuration

  1. From UMHLens / OpenLens, go to Network > Services.

  2. Find the united-manufacturing-hub-mqtt Service.

    The MQTT service name has changed since version 0.9.10. If you are using an older version, use united-manufacturing-hub-vernemq instead of united-manufacturing-hub-mqtt.

  3. Click the Edit button.

  4. Scroll down to the status.loadBalancer section and change it to the following:

    status:
      loadBalancer:
        ingress:
        - ip: <external-ip>
    

    Replace <external-ip> with the external IP address of the node.

  5. Scroll to the spec.type section and change the value from ClusterIp to LoadBalancer.

  6. Click Save to apply the changes.

Now you can connect to the MQTT broker from outside the Kubernetes cluster using the external IP address of the node as the hostname. The port is 1883.

Security considerations

There are some security considerations to keep in mind when exposing the MQTT broker.

By default, the MQTT broker is configured to allow anonymous connections. This means that anyone can connect to the broker without providing any credentials. This is not recommended for production environments.

To secure the MQTT broker, you can configure it to require authentication. For that, you can either enable RBAC or set up HiveMQ PKI (recommended for production environments).

If you are using a version of the United Manufacturing Hub older than 0.9.10, then you need to change the ACL configuration to allow your MQTT client to connect to the broker.

What’s next

Last modified May 5, 2023: feat: finishing touches (1147002)