Skip to content

Deploy EMQX on Kubernetes Using Helm Chart

This page provides step-by-step instructions for deploying EMQX on a Kubernetes cluster using the official Helm chart.

The official EMQX Helm chart simplifies Kubernetes-based deployments by packaging all required EMQX components, such as StatefulSets, Services, ConfigMaps, and Ingress rules, into a single, configurable Helm chart.

Prerequisites

Before you begin, make sure the following are installed and configured:

  • A running Kubernetes cluster (version 1.6+)
  • Helm

Install the EMQX Helm Chart

You can install the EMQX Helm chart either from the EMQX GitHub repository or from the official Helm chart repository.

Install from GitHub

To install the chart with the release name my-emqx from GitHub:

bash
$ git clone https://github.com/emqx/emqx.git
$ cd emqx/deploy/charts/emqx-enterprise
$ helm install my-emqx .

Install from Helm Repository

To install the chart with the release name my-emqx from the official Helm chart repository:

bash
helm repo add emqx https://repos.emqx.io/charts
helm install my-emqx emqx/emqx-enterprise

If you want to install an unstable version, add the --devel flag:

bash
helm install my-emqx emqx/emqx-enterprise --devel

Uninstall the Chart

To remove the EMQX release named my-emqx and delete all associated Kubernetes resources:

For Helm v3 and above

bash
$ helm uninstall  my-emqx

For Helm v2 (legacy)

bash
$ helm del  my-emqx

Configuration Parameters

The EMQX Helm chart offers a wide range of configurable parameters through the values.yaml file. Refer to the table below for key parameters and default values.

ParameterDescriptionDefault Value
replicaCountRecommended to use an odd number of nodes for automatic healing in case of a network split.3
image.repositoryEMQX Image nameemqx/emqx-enterprise
image.pullPolicyThe image pull policyIfNotPresent
image.pullSecrets The image pull secrets[] (does not add image pull secrets to deployed pods)
serviceAccount.createIf true, create a new service account.true
serviceAccount.nameService account to be used. If not set and serviceAccount.create is true, a name is generated using the full-name template.
serviceAccount.annotationsAnnotations to add to the service account.
envFromSecretThe name pulls a secret in the same Kubernetes namespace, which contains values that will be added to the environment.nil
recreatePodsForces the recreation of pods during upgrades, which can be useful to always apply the most recent configuration.false
podAnnotations Annotations for pod{}
podManagementPolicyTo redeploy a chart with existing PVC(s), the value must be set to Parallel to avoid deadlock.Parallel
persistence.enabledEnable EMQX persistence using PVC.false
persistence.storageClassStorage class of backing PVCnil (uses alpha storage class annotation)
persistence.existingClaimEMQX data Persistent Volume existing claim name, evaluated as a template.""
persistence.accessModePVC Access Mode for EMQX volumeReadWriteOnce
persistence.sizePVC Storage Request for EMQX volume20Mi
initContainersContainers that run before the creation of EMQX containers. They can contain utilities or setup scripts.{}
resourcesCPU/Memory resource requests/limits{}
extraVolumeMountsAdditional volumeMounts to the default backend container.[]
extraVolumesAdditional volumes to the default backend pod.[]
nodeSelectorNode labels for pod assignment{}
tolerationsToleration labels for pod assignment[]
affinityMap of node/pod affinities{}
service.typeKubernetes Service typeClusterIP
service.mqttPort for MQTT1883
service.mqttsslPort for MQTT(SSL)8883
service.wsPort for WebSocket/HTTP8083
service.wssPort for WSS/HTTPS8084
service.dashboardPort for dashboard and API18083
service.customPortsCustom Ports to be exposed in the Service{}
service.nodePorts.mqttKubernetes node port for MQTTnil
service.nodePorts.mqttsslKubernetes node port for MQTT(SSL)nil
service.nodePorts.wsKubernetes node port for WebSocket/HTTPnil
service.nodePorts.wssKubernetes node port for WSS/HTTPSnil
service.nodePorts.dashboardKubernetes node port for dashboardnil
service.customNodePortsKubernetes node port for custom ports{}
service.loadBalancerClassThe load balancer implementation this Service belongs to
service.loadBalancerIPloadBalancerIP for Servicenil
service.loadBalancerSourceRangesAddress(es) that are allowed when service is LoadBalancer.[]
service.externalIPsExternalIPs for the service[]
service.externalTrafficPolicyExternal Traffic Policy for the serviceCluster
service.annotationsService/ServiceMonitor annotations{}(evaluated as a template)
service.labelsService/ServiceMonitor labels{}(evaluated as a template)
ingress.dashboard.enabledEnable ingress for EMQX Dashboardfalse
ingress.dashboard.ingressClassNameSet the ingress class for EMQX Dashboard
ingress.dashboard.pathIngress path for EMQX Dashboard/
ingress.dashboard.pathTypeIngress pathType for EMQX DashboardImplementationSpecific
ingress.dashboard.hostsIngress hosts for EMQX Dashboarddashboard.emqx.local
ingress.dashboard.tlsIngress tls for EMQX Dashboard[]
ingress.dashboard.annotationsIngress annotations for EMQX Dashboard{}
ingress.dashboard.ingressClassNameSet the ingress class for EMQX Dashboard
ingress.mqtt.enabledEnable ingress for MQTTfalse
ingress.mqtt.ingressClassNameSet the ingress class for MQTT
ingress.mqtt.pathIngress path for MQTT/
ingress.mqtt.pathTypeIngress pathType for MQTTImplementationSpecific
ingress.mqtt.hostsIngress hosts for MQTTmqtt.emqx.local
ingress.mqtt.tlsIngress tls for MQTT[]
ingress.mqtt.annotationsIngress annotations for MQTT{}
ingress.mqtt.ingressClassNameSet the ingress class for MQTT
metrics.enableIf set to true, prometheus-operator needs to be installed, and emqx_prometheus needs to enable.false
metrics.typeNow we only support "prometheus"."prometheus"
ssl.enabledEnable SSL supportfalse
ssl.useExistingUse existing certificate or let cert-manager generate one.false
ssl.existingNameName of existing certificateemqx-tls
ssl.dnsnamesDNS name(s) for certificate to be generated{}
ssl.commonNameCommon name for or certificate to be generated
ssl.issuer.nameIssuer name for certificate generationletsencrypt-dns
ssl.issuer.kindIssuer kind for certificate generationClusterIssuer

EMQX-Specific Parameters

The following table lists the configurable EMQX-specific parameters of the chart and their default values.

ParameterDescriptionDefault Value
emqxConfigA map of configuration items defined using either environment variables (the EMQX_ prefix is optional) or the namespaced dotted notation used in EMQX configuration files.nil
emqxLicenseSecretNameName of the secret that holds the license information (deprecated)nil
emqxLicenseSecretRef.nameName of the secret that holds the license information""
emqxLicenseSecretRef.keyKey of the secret that holds the license information""

SSL Settings

When using cert-manager, TLS certificates are stored in Kubernetes secrets using the standard keys: tls.crt and tls.key. The EMQX Helm chart automatically mounts these certificate files to the following directory within the container:

/tmp/ssl/

To enable SSL support in EMQX, you must explicitly configure the file paths in the EMQX configuration. This can be done either by modifying the EMQX configuration file or by passing the following environment variables:

yaml
EMQX_LISTENERS__SSL__DEFAULT__SSL_OPTIONS__CERTFILE: /tmp/ssl/tls.crt
EMQX_LISTENERS__SSL__DEFAULT__SSL_OPTIONS__KEYFILE: /tmp/ssl/tls.key

TIP

If you are using an existing TLS certificate (instead of one generated by cert-manager), ensure that the file paths match the actual mounted file locations in your deployment.

Proxy Protocol Support (HAProxy, Nginx)

If deploying EMQX behind a reverse proxy that supports Proxy Protocol (e.g., HAProxy or Nginx), enable it by setting the following environment variable:

yaml
EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL: "true"

For HAProxy Ingress Controller, add this annotation:

yaml
haproxy-ingress.github.io/proxy-protocol: "v2"

This preserves the original client IP addresses forwarded through the proxy.