...
Multiple listeners allow to connect with different protocols and bind listeners to the specific network interface. You can find more details about how multiple listeners configured in HiveMq
HiveMQ provides flexible configurations to use multiple listeners for different protocols based on your need. For example, Clients with standard TCP connections can connect HIVEMQ on one port and secure TCP connections on another port. You can check here for more detailed configurations.
Similarly, it is also possible to use multiple listeners in the Kubernetes operator.
Here we are taking the example of configuring TLS and Non-TLS clients clients with standard TCP and Secured TCP to connect broker brokers via Kubernetes.
Instructions
...
Add two ports (TLS and non-TLS) via the values.yamlYAML
file
Typically 1883 for plain TCP and 8883 for 8883 TLS secured TCP
Code Block | ||
---|---|---|
| ||
ports:
- name: "mqtt"
port: 1883
expose: true
...
- name: "mqtt-tls"
port: 8883
... |
Step 2:
After adding these ports next step is to have service(s) exposing those ports to the world
You can do this in two ways,
Expose the ports directly via the use of the K8s operator patch. (You can export these configurations from the full
...
values.yaml
in our helm-chart repository.)
Code Block | ||
---|---|---|
| ||
ports: - name: "mqtt" port: 1883 expose: true patch: - '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]' # If you want Kubernetes to expose the MQTT port to external traffic - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]' - name: "mqtt-tls" port: 8883 expose: true patch: - '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]' # If you want Kubernetes to expose the MQTT port to external traffic - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]' |
...
Your cluster name is the one you have used during HiveMQ deployment while installing the helm chart.
...
helm upgrade --install -f values.yaml hivemqmy-ss cluster hivemq/hivemq-operator
here hivemqmy-sscluster
is the cluster name
next step is to apply this service manually i.e
...