Skip to content

Deploy EMQX on Azure Kubernetes Service

EMQX Operator supports deploying EMQX on Azure Kubernetes Service(AKS). AKS simplifies deploying a managed Kubernetes cluster in Azure by offloading the operational overhead to Azure. As a hosted Kubernetes service, Azure handles critical tasks, like health monitoring and maintenance. When you create an AKS cluster, a control plane is automatically created and configured. This control plane is provided at no cost as a managed Azure resource abstracted from the user. You only pay for and manage the nodes attached to the AKS cluster.

Before You Begin

Before you begin, you must have the following:

  • To create an AKS cluster on Azure, you first need to activate the AKS service in your Azure subscription. Refer to the Azure Kubernetes Service documentation for more information.

  • To connect to an AKS cluster using kubectl commands, you can install the kubectl tool locally and obtain the cluster's KubeConfig to connect to the cluster. Alternatively, you can use Cloud Shell through the Azure portal to manage the cluster with kubectl.

    • To connect to an AKS cluster using kubectl, you need to install and configure the kubectl tool on your local machine. Refer to the Connect to an AKS cluster documentation for detailed instructions on how to do this.
    • To connect to an AKS cluster using CloudShell, use Azure CloudShell to connect to the AKS cluster and manage the cluster using kubectl. Refer to the Manage an AKS cluster in Azure CloudShell documentation for detailed instructions on how to connect to Azure CloudShell and use kubectl.
  • To install EMQX Operator, please refer to Install EMQX Operator

Quickly deploying an EMQX cluster

Here are the relevant configurations for EMQX Custom Resource. You can choose the corresponding APIVersion based on the version of EMQX you wish to deploy. For specific compatibility relationships, please refer to EMQX Operator Compatibility:

Connecting to EMQX cluster to publish/subscribe messages using MQTT X CLI

MQTT X CLI is an open-source MQTT 5.0 command-line client tool designed to help developers develop and debug MQTT services and applications faster without the need for a GUI.

  • Retrieve External IP of the EMQX cluster
  • Subscribe to messages
shell
$ mqttx sub -t 'hello' -h ${external_ip} -p 1883

[10:00:25] › …  Connecting...
[10:00:25] › ✔  Connected
[10:00:25] › …  Subscribing to hello...
[10:00:25] › ✔  Subscribed to hello
  • Create a new terminal window and send a message
shell
$ mqttx pub -t 'hello' -h ${external_ip} -p 1883 -m 'hello world'

[10:00:58] › …  Connecting...
[10:00:58] › ✔  Connected
[10:00:58] › …  Message Publishing...
[10:00:58] › ✔  Message published
  • View messages received in the subscription terminal window
shell
[10:00:58] › payload: hello world

About LoadBalancer Offloading TLS

Since Azure LoadBalancer does not support TCP certificates, please refer to this document to resolve TCP certificate offloading issues.