Deploy HiveMQ using the HiveMQ platform Operator in an AKS cluster, and set up a load balancer with a static public IP.
This article walks through the step by step guide how to setup Load balancer with static public IP, when hivemq is deployed using hivemq operator in AKS cluster
Instructions
The following steps will guide you in configuring HiveMQ using the obtained IP.
Deploy AKS cluster
Create Application Gateway
Log in to the Azure portal at https://portal.azure.com.
Click on the "Create a resource" link.
Search for "Application Gateway" in the search box and select "Application Gateway."
Choose the appropriate resource group for your deployment i.e. “Application Gateway for containers “.
Provide a name and region for the application gateway.
Click the "Next" button.
Create a frontend with the name "CC."
Create an association with the name "test."
Click the "Review and create" button.
Review the configurations and click the "Create" button.
Wait for the deployment to complete. This will create the application gateway along with a static public IP.
Associate Public IP with Resources
Go to the resource group where the application gateway is deployed.
Look for the resource type "Public IP" in the list of resources and click it for next configuration.
Click the "Associate IP" button.
Select the appropriate resource to associate it with and click "Save."
Copy the static public IP address for use in the next steps.
Note: At this point, you have successfully deployed an AKS cluster and created an application gateway with a static public IP.
With the Platform Operator, you don’t need to create a Service manually. The services are defined in
values.yaml, and the operator creates them. Both services below use the same static IP on different ports.nodes: replicaCount: 2 controlCenter: username: "admin" password: "<SHA256 hash of your password>" services: - type: mqtt exposed: true containerPort: 1883 port: 1883 serviceType: LoadBalancer externalTrafficPolicy: Local annotations: service.beta.kubernetes.io/azure-load-balancer-resource-group: "<ip-resource-group>" service.beta.kubernetes.io/azure-pip-name: "<public-ip-name>" # Optional: DNS label for <dns-label>.<region>.cloudapp.azure.com # service.beta.kubernetes.io/azure-dns-label-name: "<dns-label>" - type: control-center exposed: true containerPort: 8080 port: 8080 serviceType: LoadBalancer externalTrafficPolicy: Local sessionAffinity: type: ClientIP annotations: service.beta.kubernetes.io/azure-load-balancer-resource-group: "<ip-resource-group>" service.beta.kubernetes.io/azure-pip-name: "<public-ip-name>"helm upgrade --install hivemq-broker hivemq/hivemq-platform -n hivemq -f valVerify if the pods are running as expected
kubectl get pods -n hivemq kubectl get hivemq-platforms -n hivemq
Verify the services
kubectl get svc -n hivemqThe MQTT and Control Center services should both show the static public IP in the
EXTERNAL-IPcolumn.
Test accessControl Center: open
http://<public-ip>:8080in a browser and log in.MQTT: connect a client to
<public-ip>:1883.