mosquitto

by HelmForge

Helm chartv1.6.1App 2.1.4Apache-2.0Verified publisher

A Helm chart for deploying Eclipse Mosquitto with WebSocket support and optional MQTTX Web

About this chart

Mosquitto

A Helm chart for deploying Eclipse Mosquitto on Kubernetes with standalone or federated broker topologies, WebSocket support, and an optional MQTTX Web companion UI.

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

Features

  • Official Mosquitto Image — the default uses the verified multi-architecture eclipse-mosquitto:2.1.4-alpine image.
  • Standalone or Federated Topology — run a single broker or a bridged StatefulSet of brokers
  • Kubernetes Placement Defaults — optional anti-affinity and topology spread defaults for multi-replica broker pods
  • WebSocket Listener — browser-ready MQTT access through a dedicated listener
  • Authentication and ACL — optional password file and ACL file generation
  • Native MQTT TLS Listener — optional TLS/mTLS listener using an existing Kubernetes Secret
  • Broker Pressure Limits — optional connection and queue/message size limits to reduce abuse impact
  • MQTTX Web Companion — optional browser client deployment for quick testing
  • Secure Runtime Defaults — non-root containers, read-only root filesystems, dropped capabilities, RuntimeDefault seccomp, and disabled API token mounts
  • Ingress NetworkPolicies — listener-specific policies for broker and MQTTX pods
  • Service exposure — optional externalIPs and static Kubernetes nodePort values per listener (MQTT, WebSocket, MQTTS)
  • Values Schema — values.schema.json validates user-supplied values and improves ArtifactHub rendering

Security Scan

Security Scan: mosquitto

FrameworkScore
MITRE + NSA + SOC293.93939%

Security posture acceptable.

Important Notes

  • architecture.mode=standalone is the default and requires exactly one broker replica
  • architecture.mode=federated creates 2+ Mosquitto brokers bridged together through the StatefulSet headless DNS names
  • federated mode is based on Mosquitto bridges, not on native shared-state clustering
  • federated brokers still do not share sessions or retained state like a true clustered MQTT platform
  • the default Service routing uses sessionAffinity=None for broader compatibility; enable ClientIP only when sticky routing is explicitly needed
  • set service.mqttNodePort, service.websocketNodePort, and service.mqttsNodePort to a non-zero port (typically 30000–32767) to pin static NodePorts; keep them at 0 to let the cluster assign ports automatically
  • service.externalIPs maps to spec.externalIPs on the broker Service for clusters that route traffic to those addresses
  • federated multi-replica installs automatically prefer spreading broker pods across nodes unless you provide custom affinity or topologySpreadConstraints
  • when broker.tls.enabled=true, set broker.tls.certSecretName to an existing Secret containing tls.crt and tls.key (and optionally ca.crt for mTLS)
  • when broker.tls.enabled=true, the chart disables the plain MQTT 1883 listener and Service port, serving MQTT only on broker.tls.port (default 8883)
  • MQTTX Web is pinned to emqx/mqttx-web:v1.13.1, and its process listener is controlled by mqttxWeb.containerPort independently from mqttxWeb.service.port
  • the official Mosquitto image tag validated for this chart is eclipse-mosquitto:2.1.4-alpine
  • Mosquitto 2.1 defaults max_packet_size to 2,000,000 bytes; set broker.limits.maxPacketSize explicitly when clients require larger packets

Architecture

Standalone mode runs one broker with one persistent data boundary. Federated mode runs two or more StatefulSet replicas and generates Mosquitto bridges between their stable headless-Service names. Federation relays matching topic traffic, but sessions, persistence, and retained state remain broker-local. MQTTX Web is an independent Deployment that reaches the broker through its WebSocket listener.

Quick Start

helm install mosquitto oci://ghcr.io/helmforgedev/helm/mosquitto \
  --set auth.enabled=true \
  --set auth.password=change-me

Example Configurations

Basic Broker

architecture:
  mode: standalone

broker:
  replicaCount: 1

Federated Brokers

architecture:
  mode: federated

broker:
  replicaCount: 3

service:
  sessionAffinity: None

pdb:
  enabled: true
  minAvailable: 2

Broker with MQTTX Web

websocketIngress:
  enabled: true
  ingressClassName: traefik
  hosts:
    - host: mqtt.example.com
      paths:
        - path: /mqtt
          pathType: Prefix

mqttxWeb:
  enabled: true
  ingress:
    enabled: true
    ingressClassName: traefik
    hosts:
      - host: mqttx.example.com
        paths:
          - path: /
            pathType: Prefix

NodePort with static NodePorts and external IPs

service:
  type: NodePort
  mqttNodePort: 31883
  websocketNodePort: 31901
  externalIPs:
    - 203.0.113.10

When broker.tls.enabled=true, use service.mqttsNodePort instead of mqttNodePort for the TLS listener.

Public Broker with MQTT TLS

service:
  type: LoadBalancer

auth:
  enabled: true

acl:
  enabled: true

broker:
  tls:
    enabled: true
    certSecretName: mosquitto-tls
    port: 8883
  limits:
    maxConnections: 10000
    maxInflightMessages: 100
    maxQueuedMessages: 1000
    maxQueuedBytes: 1048576
    maxPacketSize: 262144

Eliminating TLS health check log spam (OpenSSL EOF)

When broker.tls.enabled is true and broker.listeners.websocketEnabled is false, Kubernetes TCP socket health probes and/or a Cloud Load Balancer health checks (e.g., AWS NLB) will ping the mqtts port. Because the probes immediately close the connection without completing a TLS handshake, Mosquitto will constantly log OpenSSL errors (e.g., error:0A000126:SSL routines::unexpected eof while reading).

To eliminate this log spam, you can use broker.extraConfig to create a dedicated, plaintext health check listener, and use broker.probePortOverride to point the Kubernetes probes to it.

broker:
  # Point health probes/checks to the custom plaintext port
  probePortOverride: 9000

  extraConfig: |
    # Create a dedicated plaintext listener for health checks
    listener 9000
    protocol mqtt

    # Silence the TCP connection logs
    connection_messages false

Resource metadata and PVC retention

Use commonAnnotations to add annotations to every chart-owned resource. Resource-specific annotations, such as service.annotations, take precedence when the same key is present in both maps.

Persistent broker PVCs default to Retain when the StatefulSet is deleted or scaled down. Set broker.persistence.retentionPolicy.whenDeleted or whenScaled to Delete only when automatic data removal is intentional. On Kubernetes 1.26, deletion requires the StatefulSetAutoDeletePVC feature gate on the API server and controller manager. The gate is enabled by default from Kubernetes 1.27 through 1.31 but can still be disabled, so verify both the API server and controller manager settings. The feature is stable from Kubernetes 1.32.

Key Values

KeyDefaultDescription
commonAnnotations{}Annotations added to chart-owned resources; resource-specific values take precedence
architecture.modestandaloneBroker topology: standalone or federated
broker.replicaCount1Number of broker replicas
broker.listeners.mqtt1883MQTT TCP listener port
broker.listeners.websocketEnabledtrueEnable MQTT over WebSocket listener
broker.listeners.websocket9001MQTT over WebSocket listener port
broker.tls.enabledfalseEnable broker MQTT TLS listener and disable plain MQTT 1883
broker.tls.certSecretName""Secret containing tls.crt and tls.key
broker.limits.maxConnections0Maximum simultaneously connected clients (0 keeps broker default)
broker.limits.maxPacketSize0Maximum accepted MQTT packet size in bytes (0 keeps broker default)
broker.federation.topicPattern#Topic pattern bridged between federated brokers
broker.persistence.retentionPolicy.whenDeletedRetainPVC retention when the StatefulSet is deleted
broker.persistence.retentionPolicy.whenScaledRetainPVC retention when broker replicas are scaled down
auth.enabledfalseEnable username/password authentication
auth.password""Password; preserved by live Helm upgrades when empty; use auth.existingSecret with render-only or GitOps workflows
acl.enabledfalseEnable ACL file generation
service.typeClusterIPService type: ClusterIP, NodePort, or LoadBalancer
service.sessionAffinityNoneService routing policy for client traffic
service.mqttPort1883Service port for plain MQTT (when TLS is disabled)
service.websocketPort9001Service port for WebSocket
service.mqttsPort8883Service port for MQTT TLS (when TLS is enabled)
service.mqttNodePort0Static NodePort for MQTT; 0 omits the field (auto-assigned when using NodePort/LoadBalancer)
service.websocketNodePort0Static NodePort for WebSocket
service.mqttsNodePort0Static NodePort for MQTTS (TLS)
service.externalIPs[]Optional spec.externalIPs entries for the broker Service
service.externalTrafficPolicyClusterUsed when service.type is NodePort or LoadBalancer
websocketIngress.enabledfalseExpose broker WebSocket through ingress
mqttxWeb.enabledfalseDeploy MQTTX Web companion UI
mqttxWeb.containerPort8080Listener passed to the MQTTX Web http-server process
mqttxWeb.service.port80Independent Kubernetes Service port for MQTTX Web
networkPolicy.enabledtrueRestrict ingress to declared broker and MQTTX listeners
serviceAccount.automountServiceAccountTokenfalseMount the Kubernetes API token into pods

Security

The chart applies a restricted container baseline by default, but the default broker permits anonymous clients for evaluation. Before public exposure, enable authentication, least-privilege ACL rules, TLS or mTLS, and explicit resource and broker pressure limits. See Security for the trust boundaries and a production checklist.

Troubleshooting

Use the commands printed by helm get notes to inspect pods, generated broker configuration, and logs. Listener failures usually indicate a port collision or TLS Secret mismatch. Authentication failures should be checked against the effective Secret keys and ACL rules. Federation problems should be diagnosed per broker because bridge connectivity and retained state are broker-local. See Operations for upgrade, backup, and recovery guidance.

More Information

Deploy mosquitto with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mosquitto on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmosquitto is pinned at v1.6.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply