mosquitto
by HelmForge
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-alpineimage. - Standalone or Federated Topology — run a single broker or a bridged
StatefulSetof 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
externalIPsand static KubernetesnodePortvalues per listener (MQTT, WebSocket, MQTTS) - Values Schema —
values.schema.jsonvalidates user-supplied values and improves ArtifactHub rendering
Security Scan
Security Scan: mosquitto
| Framework | Score |
|---|---|
| MITRE + NSA + SOC2 | 93.93939% |
Security posture acceptable.
Important Notes
architecture.mode=standaloneis the default and requires exactly one broker replicaarchitecture.mode=federatedcreates 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=Nonefor broader compatibility; enableClientIPonly when sticky routing is explicitly needed - set
service.mqttNodePort,service.websocketNodePort, andservice.mqttsNodePortto a non-zero port (typically30000–32767) to pin static NodePorts; keep them at0to let the cluster assign ports automatically service.externalIPsmaps tospec.externalIPson 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
affinityortopologySpreadConstraints - when
broker.tls.enabled=true, setbroker.tls.certSecretNameto an existing Secret containingtls.crtandtls.key(and optionallyca.crtfor mTLS) - when
broker.tls.enabled=true, the chart disables the plain MQTT1883listener and Service port, serving MQTT only onbroker.tls.port(default8883) - MQTTX Web is pinned to
emqx/mqttx-web:v1.13.1, and its process listener is controlled bymqttxWeb.containerPortindependently frommqttxWeb.service.port - the official Mosquitto image tag validated for this chart is
eclipse-mosquitto:2.1.4-alpine - Mosquitto 2.1 defaults
max_packet_sizeto 2,000,000 bytes; setbroker.limits.maxPacketSizeexplicitly 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
| Key | Default | Description |
|---|---|---|
commonAnnotations | {} | Annotations added to chart-owned resources; resource-specific values take precedence |
architecture.mode | standalone | Broker topology: standalone or federated |
broker.replicaCount | 1 | Number of broker replicas |
broker.listeners.mqtt | 1883 | MQTT TCP listener port |
broker.listeners.websocketEnabled | true | Enable MQTT over WebSocket listener |
broker.listeners.websocket | 9001 | MQTT over WebSocket listener port |
broker.tls.enabled | false | Enable broker MQTT TLS listener and disable plain MQTT 1883 |
broker.tls.certSecretName | "" | Secret containing tls.crt and tls.key |
broker.limits.maxConnections | 0 | Maximum simultaneously connected clients (0 keeps broker default) |
broker.limits.maxPacketSize | 0 | Maximum accepted MQTT packet size in bytes (0 keeps broker default) |
broker.federation.topicPattern | # | Topic pattern bridged between federated brokers |
broker.persistence.retentionPolicy.whenDeleted | Retain | PVC retention when the StatefulSet is deleted |
broker.persistence.retentionPolicy.whenScaled | Retain | PVC retention when broker replicas are scaled down |
auth.enabled | false | Enable username/password authentication |
auth.password | "" | Password; preserved by live Helm upgrades when empty; use auth.existingSecret with render-only or GitOps workflows |
acl.enabled | false | Enable ACL file generation |
service.type | ClusterIP | Service type: ClusterIP, NodePort, or LoadBalancer |
service.sessionAffinity | None | Service routing policy for client traffic |
service.mqttPort | 1883 | Service port for plain MQTT (when TLS is disabled) |
service.websocketPort | 9001 | Service port for WebSocket |
service.mqttsPort | 8883 | Service port for MQTT TLS (when TLS is enabled) |
service.mqttNodePort | 0 | Static NodePort for MQTT; 0 omits the field (auto-assigned when using NodePort/LoadBalancer) |
service.websocketNodePort | 0 | Static NodePort for WebSocket |
service.mqttsNodePort | 0 | Static NodePort for MQTTS (TLS) |
service.externalIPs | [] | Optional spec.externalIPs entries for the broker Service |
service.externalTrafficPolicy | Cluster | Used when service.type is NodePort or LoadBalancer |
websocketIngress.enabled | false | Expose broker WebSocket through ingress |
mqttxWeb.enabled | false | Deploy MQTTX Web companion UI |
mqttxWeb.containerPort | 8080 | Listener passed to the MQTTX Web http-server process |
mqttxWeb.service.port | 80 | Independent Kubernetes Service port for MQTTX Web |
networkPolicy.enabled | true | Restrict ingress to declared broker and MQTTX listeners |
serviceAccount.automountServiceAccountToken | false | Mount 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
- Architecture Notes
- Security
- Operations
- Examples
- Source code and full values reference
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmosquitto is pinned at v1.6.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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