mosquitto

by bdclark

Helm chartv0.7.0App 2.0.23MITVerified publisher

Eclipse Mosquitto MQTT broker with authentication and persistence support

About this chart

Mosquitto Helm Chart

Eclipse Mosquitto MQTT broker with authentication and persistence support

Installing

From repo

helm repo add bdclark https://bdclark.github.io/helm-charts
helm repo update
helm install mosquitto bdclark/mosquitto

From source

helm install mosquitto ./charts/mosquitto

Uninstall

helm uninstall mosquitto

Features

  • Plain MQTT, TLS MQTT, and WebSocket MQTT endpoints
  • Optional host networking or host ports for bare-metal clusters
  • Configurable authentication (inline users or secrets) and ACLs (see AUTH.md)
  • Optional persistence for DB and offline messages
  • Helm tests + unit tests (helm-unittest) for confidence

Persistence and update strategy

When persistence is enabled, Mosquitto runs as a single replica with a single PVC.

  • Persistence disabled: uses Kubernetes default update behavior (RollingUpdate unless otherwise set).
  • Persistence enabled: defaults to Recreate to avoid ReadWriteOnce attach/mount conflicts.

The deployment strategy may be overridden explicitly, for example:

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 0
    maxUnavailable: 1

Common overrides

Enable persistence + TLS port

persistence:
  enabled: true
  size: 5Gi

service:
  type: LoadBalancer
  ports:
    mqttTls:
      enabled: true
      tls:
        secretName: mosquitto-tls

External secret for users

auth:
  secretRef:
    name: mosquitto-auth
    key: passwd
config:
  allowAnonymous: false

Configuration

KeyTypeDefaultDescription
image.repositorystring"eclipse-mosquitto"Image repository
image.tagstring""Image tag (defaults to appVersion from Chart.yaml)
image.pullPolicystring"IfNotPresent"Image pull policy
imagePullSecretslist[]Image pull secrets for private registries
nameOverridestring""Override the chart name
fullnameOverridestring""Override the full release name
deploymentAnnotationsobject{}Annotations for the Deployment.
extraDeploymentLabelsobject{}Additional labels for the Deployment.
podAnnotationsobject{}Pod annotations applied to the broker pod
podLabelsobject{}Extra labels applied to the broker pod
commonLabelsobject{}Labels to add to all resources.
podSecurityContextobject{}Pod-level security context
securityContextobject{}Container-level security context
resourcesobject{}Resource requests and limits
strategyobject{}Deployment update strategy. If not set, defaults to Recreate when persistence.enabled=true, otherwise uses Kubernetes default (RollingUpdate).
service.typestring"ClusterIP"Service type (ClusterIP/LoadBalancer/NodePort)
service.annotationsobject{}Service annotations for load balancer configuration
service.loadBalancerIPstring""Static IP for LoadBalancer services
service.loadBalancerSourceRangeslist[]Allowed source ranges for LoadBalancer
service.externalTrafficPolicystring"Cluster"Preserve client IP for LoadBalancer/NodePort
service.sessionAffinitystring"None"Session affinity mode
service.ports.mqtt.enabledbooltrueEnable plain MQTT port
service.ports.mqtt.portint1883MQTT port number
service.ports.mqtt.targetPortint1883Target port in the pod
service.ports.mqtt.protocolstring"TCP"Protocol used by the service
service.ports.mqtt.nodePortstring""NodePort for NodePort service type (leave empty for auto-assignment)
service.ports.mqttTls.enabledboolfalseEnable MQTT over TLS port
service.ports.mqttTls.portint8883MQTT over TLS port number
service.ports.mqttTls.targetPortint8883Target port in the pod
service.ports.mqttTls.protocolstring"TCP"Protocol used by the service
service.ports.mqttTls.nodePortstring""NodePort for NodePort service type (leave empty for auto-assignment)
service.ports.mqttTls.tls.secretNamestring""Secret containing TLS certificates
service.ports.mqttTls.tls.caFilestring"ca.crt"CA certificate key in the secret
service.ports.mqttTls.tls.certFilestring"tls.crt"Server certificate key in the secret
service.ports.mqttTls.tls.keyFilestring"tls.key"Server private key key in the secret
service.ports.websocket.enabledboolfalseEnable MQTT over WebSocket port
service.ports.websocket.portint9001MQTT over WebSocket port number
service.ports.websocket.targetPortint9001Target port in the pod
service.ports.websocket.protocolstring"TCP"Protocol used by the service
service.ports.websocket.nodePortstring""NodePort for NodePort service type (leave empty for auto-assignment)
hostNetwork.enabledboolfalseEnable host networking (pod uses node network namespace)
hostNetwork.dnsPolicystring"ClusterFirstWithHostNet"DNS policy when using host networking
hostPorts.enabledboolfalseEnable hostPort configuration
hostPorts.mqtt.portstring""Host port for plain MQTT (leave empty to disable)
hostPorts.mqtt.hostIPstring""Specific host IP to bind (empty = all interfaces)
hostPorts.mqttTls.portstring""Host port for TLS MQTT
hostPorts.mqttTls.hostIPstring""Specific host IP to bind (empty = all interfaces)
hostPorts.websocket.portstring""Host port for WebSocket MQTT
hostPorts.websocket.hostIPstring""Specific host IP to bind (empty = all interfaces)
ingress.enabledboolfalseEnable ingress for WebSocket port
ingress.classNamestring""Ingress class name
ingress.annotationsobject{}Additional ingress annotations
ingress.hostslist[{"host":"mosquitto.local","paths":[{"path":"/mqtt","pathType":"Prefix","service":{"name":"websocket"}}]}]Ingress rules configuration
ingress.tlslist[]TLS configuration for ingress
livenessProbeobject{"initialDelaySeconds":30,"periodSeconds":10,"tcpSocket":{"port":"mqtt"}}Liveness probe
readinessProbeobject{"initialDelaySeconds":5,"periodSeconds":5,"tcpSocket":{"port":"mqtt"}}Readiness probe
config.allowAnonymousbooltrueAllow anonymous connections (auto-disabled when users are defined)
config.logLevelstring"information"Broker log level
config.maxConnectionsint0Max concurrent client connections (0 = unlimited)
config.extraConfigstring""Additional configuration appended verbatim
auth.userslist[]Inline users/passwords stored in ConfigMap (development/testing)
auth.secretRef.namestring""Name of secret containing passwd file (takes precedence over users)
auth.secretRef.keystring"passwd"Key in the secret containing passwd file content
auth.aclsstring""ACL entries in Mosquitto ACL file format
persistence.enabledboolfalseEnable persistent volume for Mosquitto data
persistence.storageClassstring""Storage class for PVC (set to "-" to disable dynamic provisioning)
persistence.accessModeslist["ReadWriteOnce"]Access modes for the PVC
persistence.sizestring"1Gi"Requested PVC size
persistence.existingClaimstring""Use an existing PVC instead of creating a new one
persistence.extraLabelsobject{}Additional labels for PVCs created by this chart.
persistence.annotationsobject{}Annotations for PVC
nodeSelectorobject{}Node selector for scheduling
tolerationslist[]Pod tolerations
affinityobject{}Pod affinity / anti-affinity rules

Contributing

  • Bump version/appVersion in Chart.yaml for any change.
  • Keep helm-unittest specs (charts/mosquitto/tests/) and integration tests (tests/integration/pytest_suite/charts/test_mosquitto.py) up to date.
  • Run task verify-chart CHART=mosquitto + targeted task pytest before opening a PR.

License

MIT — see LICENSE.

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 v0.7.0 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