Skip to content

Mosquitto

Eclipse Mosquitto MQTT broker for IoT and messaging workloads. Mosquitto handles MQTT publish/subscribe messaging for devices and services, supports QoS 0/1/2, retained messages, and persistent sessions. This chart supports standalone single-broker deployments and federated multi-broker topologies with bridge connections.

Authentication is disabled by default — broker is open

With auth.enabled: false (the default), any MQTT client that can reach the broker service can publish and subscribe to any topic without credentials. Enable auth.enabled: true and set credentials before exposing the broker to untrusted networks.

Key Features

  • MQTT TCP and WebSocket listeners — native MQTT on port 1883, MQTT over WebSocket on port 9001
  • TLS and mTLS — encrypt broker traffic and authenticate devices via client certificates
  • Authentication and ACL — username/password and topic-level access control rules
  • Standalone mode — single broker, simplest deployment for most use cases
  • Federated mode — bridged brokers across StatefulSet peers for multi-node spread
  • PodDisruptionBudget — built-in disruption protection enabled by default
  • MQTTX Web companion — optional browser-based MQTT client for testing and debugging
  • Connection and queue limits — configurable caps to prevent runaway memory usage

Topology

Federated mode uses bridges, not native clustering

Federated mode connects multiple Mosquitto broker pods via Mosquitto bridge connections. Each broker maintains its own independent state — subscriptions, sessions, and retained messages are local to each pod. Messages published on one broker are relayed to peers via the bridge. For IoT devices that must maintain persistent sessions, use service.sessionAffinity: ClientIP to ensure a client always reconnects to the same broker pod.

FeatureStandaloneFederated
Broker replicas12+
Session stateSingle brokerPer-pod (not shared)
Retained messagesSingle brokerPer-pod (not shared)
Message relayBridge (configurable pattern)
Use caseMost deploymentsMulti-zone spread, HA

Installation

HTTPS repository:

helm repo add helmforge https://repo.helmforge.dev
helm repo update
helm install mosquitto helmforge/mosquitto

OCI registry:

helm install mosquitto oci://ghcr.io/helmforgedev/helm/mosquitto

Deployment Examples

# values.yaml — Mosquitto standalone broker with authentication
architecture:
  mode: standalone

auth:
  enabled: true
  username: mqtt
  password: 'your-mqtt-password'

acl:
  enabled: true
  rules: |
    # Allow the mqtt user full access
    user mqtt
    topic readwrite #

broker:
  replicaCount: 1
  persistence:
    enabled: true
    size: 8Gi
# values.yaml — Authentication with an existing Kubernetes Secret
architecture:
  mode: standalone

auth:
  enabled: true
  existingSecret: mosquitto-credentials
  existingSecretUsernameKey: username
  existingSecretPasswordKey: password

acl:
  enabled: true
  rules: |
    user mqtt
    topic readwrite #
    user readonly
    topic read sensors/#

broker:
  persistence:
    enabled: true
    size: 8Gi
# values.yaml — MQTT over TLS (MQTTS on port 8883)
# The TLS secret must contain tls.crt and tls.key
architecture:
  mode: standalone

auth:
  enabled: true
  username: mqtt
  password: 'your-mqtt-password'

broker:
  tls:
    enabled: true
    port: 8883
    certSecretName: mosquitto-tls
    certFile: tls.crt
    keyFile: tls.key
    # Optional: enable mTLS (client certificate authentication)
    # caFile: ca.crt
    # requireCertificate: true
    # useIdentityAsUsername: true

  persistence:
    enabled: true
    size: 8Gi

service:
  type: LoadBalancer
  mqttsPort: 8883
# values.yaml — Federated Mosquitto with 3 bridged broker pods
# Each pod bridges all topics (#) bidirectionally to its peers.
# Use ClientIP session affinity to ensure MQTT clients reconnect to the same pod.
architecture:
  mode: federated

auth:
  enabled: true
  username: mqtt
  password: 'your-mqtt-password'

broker:
  replicaCount: 3
  federation:
    topicPattern: '#'
    topicDirection: both
    topicQos: 1
  persistence:
    enabled: true
    size: 8Gi

service:
  sessionAffinity: ClientIP

pdb:
  enabled: true
  minAvailable: 2
# values.yaml — Mosquitto with MQTTX Web companion UI
# MQTTX Web connects to Mosquitto via the WebSocket listener (port 9001).
# Expose the WebSocket listener via Ingress for browser access.
architecture:
  mode: standalone

auth:
  enabled: true
  username: mqtt
  password: 'your-mqtt-password'

broker:
  persistence:
    enabled: true
    size: 8Gi

websocketIngress:
  enabled: true
  ingressClassName: traefik
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  hosts:
    - host: mqtt.example.com
      paths:
        - path: /mqtt
          pathType: Prefix
  tls:
    - secretName: mosquitto-ws-tls
      hosts:
        - mqtt.example.com

mqttxWeb:
  enabled: true
  replicaCount: 1
  broker:
    scheme: wss
    host: mqtt.example.com
    path: /mqtt
  ingress:
    enabled: true
    ingressClassName: traefik
    hosts:
      - host: mqttx.example.com
        paths:
          - path: /
            pathType: Prefix

Configuration Reference

Core

ParameterTypeDefaultDescription
nameOverridestring""Override the chart name.
fullnameOverridestring""Override the full release name.
commonLabelsobject{}Extra labels added to all resources.
clusterDomainstringcluster.localKubernetes cluster domain for internal DNS resolution.

Image

ParameterTypeDefaultDescription
image.repositorystringdocker.io/library/eclipse-mosquittoMosquitto container image.
image.tagstring"2.0.22"Image tag.
image.pullPolicystringIfNotPresentImage pull policy.
imagePullSecretsarray[]Pull secrets for private registries.

Architecture

ParameterTypeDefaultDescription
architecture.modestringstandaloneBroker topology: standalone (1 broker) or federated (bridged peers).

Broker

ParameterTypeDefaultDescription
broker.replicaCountinteger1Number of Mosquitto broker pods.
broker.extraConfigstring""Raw Mosquitto configuration lines appended to the generated mosquitto.conf.
broker.listeners.mqttinteger1883MQTT TCP listener port (when TLS is disabled).
broker.listeners.websocketinteger9001MQTT over WebSocket listener port.

Multi-Replica Defaults

ParameterTypeDefaultDescription
broker.multiReplicaDefaults.enabledbooleantrueApply scheduling defaults automatically when replicaCount > 1.
broker.multiReplicaDefaults.podAntiAffinitystringpreferredPod anti-affinity: preferred, required, or none.
broker.multiReplicaDefaults.topologySpread.enabledbooleantrueAdd a topology spread constraint for multi-replica brokers.
broker.multiReplicaDefaults.topologySpread.topologyKeystringkubernetes.io/hostnameNode topology key for the spread constraint.

TLS

ParameterTypeDefaultDescription
broker.tls.enabledbooleanfalseEnable MQTT TLS listener (MQTTS).
broker.tls.portinteger8883MQTTS listener port.
broker.tls.certSecretNamestring""Existing Secret name containing the broker TLS certificate and key.
broker.tls.certFilestringtls.crtKey name in the Secret for the server certificate.
broker.tls.keyFilestringtls.keyKey name in the Secret for the server private key.
broker.tls.caFilestring""Key name in the Secret for the CA certificate (required for mTLS).
broker.tls.requireCertificatebooleanfalseRequire clients to present a valid certificate (mTLS).
broker.tls.useIdentityAsUsernamebooleanfalseUse the client certificate CN as the MQTT username when mTLS is enabled.
Use mTLS for IoT device authentication

For IoT deployments where devices (ESP32, Raspberry Pi) need individual identities, enable mTLS by setting broker.tls.requireCertificate: true and broker.tls.useIdentityAsUsername: true. Each device gets its own client certificate. The certificate CN is used as the MQTT username for ACL enforcement, removing the need for a shared password across all devices.

Limits

All limit values default to 0, which means the Mosquitto broker default applies (typically unlimited). Set explicit limits for production deployments with many connected devices.

ParameterTypeDefaultDescription
broker.limits.maxConnectionsinteger0Maximum concurrently connected clients. 0 = unlimited.
broker.limits.maxInflightMessagesinteger0Maximum in-flight QoS 1/2 messages per client. 0 = unlimited.
broker.limits.maxQueuedMessagesinteger0Maximum queued QoS 1/2 messages per client. 0 = unlimited.
broker.limits.maxQueuedBytesinteger0Maximum queued message bytes per client. 0 = unlimited.
broker.limits.maxPacketSizeinteger0Maximum MQTT packet size in bytes. 0 = unlimited.

Federation

ParameterTypeDefaultDescription
broker.federation.topicPatternstring"#"MQTT topic pattern bridged between broker peers.
broker.federation.topicDirectionstringbothBridge direction: both, out, or in.
broker.federation.topicQosinteger1QoS for bridged messages.
broker.federation.tryPrivatebooleantrueAdvertise bridge semantics to remote peers (loop handling).
broker.federation.restartTimeoutBaseinteger5Base seconds for bridge reconnection backoff.
broker.federation.restartTimeoutCapinteger30Maximum seconds for bridge reconnection backoff.

Persistence

ParameterTypeDefaultDescription
broker.persistence.enabledbooleantrueEnable PVCs for broker data.
broker.persistence.sizestring8GiSize of each broker PVC.
broker.persistence.storageClassstring""StorageClass for broker PVCs.
broker.persistence.accessModestringReadWriteOncePVC access mode.

Authentication

ParameterTypeDefaultDescription
auth.enabledbooleanfalseEnable username/password authentication.
auth.usernamestringmqttUsername stored in the generated password file.
auth.passwordstring""Password. Auto-generated if empty.
auth.existingSecretstring""Existing Kubernetes Secret with MQTT credentials.
auth.existingSecretUsernameKeystringusernameKey in the existing secret for the username.
auth.existingSecretPasswordKeystringpasswordKey in the existing secret for the password.

ACL

ParameterTypeDefaultDescription
acl.enabledbooleanfalseEnable ACL file generation and enforcement.
acl.rulesstring""Raw Mosquitto ACL rules written to the broker’s aclfile.
acl.existingConfigMapstring""Existing ConfigMap containing a custom aclfile.
acl.existingConfigMapKeystringaclfileConfigMap key name for the ACL file content.

Service

ParameterTypeDefaultDescription
service.typestringClusterIPKubernetes service type.
service.sessionAffinitystringNoneSession affinity. Use ClientIP in federated mode to maintain MQTT sessions.
service.externalTrafficPolicystringClusterExternal traffic policy for NodePort/LoadBalancer.
service.annotationsobject{}Annotations for the broker Service.
service.mqttPortinteger1883Override MQTT service port.
service.websocketPortinteger9001Override WebSocket service port.
service.mqttsPortinteger8883Override MQTTS service port (when broker.tls.enabled: true).
service.mqttNodePortinteger0NodePort for MQTT (0 = cluster assigns).
service.websocketNodePortinteger0NodePort for WebSocket (0 = cluster assigns).
service.mqttsNodePortinteger0NodePort for MQTTS (0 = cluster assigns).
service.externalIPsarray[]External IPs for the broker Service.

WebSocket Ingress

ParameterTypeDefaultDescription
websocketIngress.enabledbooleanfalseEnable Ingress for the MQTT WebSocket listener.
websocketIngress.ingressClassNamestring""Ingress class name. Must be set explicitly.
websocketIngress.annotationsobject{}Annotations for the WebSocket Ingress.
websocketIngress.hostsarray[]WebSocket Ingress host and path rules.
websocketIngress.tlsarray[]TLS configuration for the WebSocket Ingress.

MQTTX Web

ParameterTypeDefaultDescription
mqttxWeb.enabledbooleanfalseDeploy the MQTTX Web companion browser client.
mqttxWeb.image.repositorystringdocker.io/emqx/mqttx-webMQTTX Web container image.
mqttxWeb.image.tagstring""Image tag. Defaults to the upstream image default tag.
mqttxWeb.replicaCountinteger1Number of MQTTX Web replicas (independent from broker replicas).
mqttxWeb.service.typestringClusterIPService type for MQTTX Web.
mqttxWeb.service.portinteger80HTTP service port for MQTTX Web.
mqttxWeb.broker.schemestringwsWebSocket scheme for browser connections: ws or wss.
mqttxWeb.broker.hoststring""Browser-visible broker hostname. Defaults to websocketIngress host.
mqttxWeb.broker.portinteger0Browser-visible port override. 0 = derive from ingress/service.
mqttxWeb.broker.pathstring/mqttWebSocket path used by browsers.
mqttxWeb.broker.connectionNamestringMosquittoDefault connection name in the MQTTX Web UI.
mqttxWeb.resourcesobject{}Resources for MQTTX Web pods.
mqttxWeb.ingress.enabledbooleanfalseEnable Ingress for MQTTX Web.
mqttxWeb.ingress.ingressClassNamestring""Ingress class name for MQTTX Web.
mqttxWeb.ingress.hostsarray[]MQTTX Web Ingress hosts.
mqttxWeb.ingress.tlsarray[]MQTTX Web Ingress TLS configuration.

PodDisruptionBudget

ParameterTypeDefaultDescription
pdb.enabledbooleantrueCreate a PodDisruptionBudget for broker pods.
pdb.minAvailableinteger1Minimum available broker pods during voluntary cluster disruptions.

Probes

ParameterTypeDefaultDescription
startupProbe.enabledbooleantrueEnable startup probe.
startupProbe.initialDelaySecondsinteger5Startup probe initial delay.
startupProbe.periodSecondsinteger10Startup probe period.
startupProbe.timeoutSecondsinteger5Startup probe timeout.
startupProbe.failureThresholdinteger30Startup probe failure threshold.
livenessProbe.enabledbooleantrueEnable liveness probe.
livenessProbe.initialDelaySecondsinteger0Liveness probe initial delay.
livenessProbe.periodSecondsinteger20Liveness probe period.
livenessProbe.timeoutSecondsinteger5Liveness probe timeout.
livenessProbe.failureThresholdinteger3Liveness probe failure threshold.
readinessProbe.enabledbooleantrueEnable readiness probe.
readinessProbe.initialDelaySecondsinteger0Readiness probe initial delay.
readinessProbe.periodSecondsinteger10Readiness probe period.
readinessProbe.timeoutSecondsinteger5Readiness probe timeout.
readinessProbe.failureThresholdinteger3Readiness probe failure threshold.

Resources and Security

ParameterTypeDefaultDescription
resourcesobject{}CPU and memory requests and limits.
podSecurityContextobject{}Pod-level security context.
securityContextobject{}Container-level security context.

Service Account

ParameterTypeDefaultDescription
serviceAccount.createbooleanfalseCreate a dedicated ServiceAccount.
serviceAccount.namestring""Override the ServiceAccount name.
serviceAccount.annotationsobject{}Annotations for the ServiceAccount.

Scheduling

ParameterTypeDefaultDescription
nodeSelectorobject{}Node selector for scheduling.
tolerationsarray[]Tolerations for scheduling.
affinityobject{}Affinity rules.
topologySpreadConstraintsarray[]Topology spread constraints.
priorityClassNamestring""PriorityClass for the pod.
terminationGracePeriodSecondsinteger30Termination grace period.
podLabelsobject{}Extra labels for the pod.
podAnnotationsobject{}Extra annotations for the pod.

Extra

ParameterTypeDefaultDescription
extraVolumesarray[]Extra volumes to attach to the pod.
extraVolumeMountsarray[]Extra volume mounts for the container.
extraManifestsarray[]Extra Kubernetes manifests deployed alongside the chart.

More Information