Mosquitto MQTT
Mosquitto MQTT
Purpose
Eclipse Mosquitto is the MQTT broker used by Home Assistant and other IoT devices in the homelab. Runs as a single Deployment in the default namespace of the k3s cluster.
Deployment
| Item | Value |
|---|---|
| Namespace | default |
| Image | eclipse-mosquitto:2.1.2-alpine |
| Replicas | 1 |
| Ports | 1883 (MQTT), 9001 (MQTT over WebSockets) |
| Resources | requests 20m/32Mi, limits 200m/128Mi |
| Storage | PVC mosquitto-storage, 1Gi, storageClassName: local-path (persistence + logs) |
| Reloader | reloader.stakater.com/auto: "true" |
Configuration
mosquitto.conf is supplied via a ConfigMap (mosquitto-config) and requires username/password authentication (allow_anonymous false, password_file /mosquitto/config/passwd). Persistence and file logging are both enabled.
The password file itself lives in a Secret (mosquitto-passwd), mounted read-only into an emptyDir by an init container (fix-passwd-perms) that copies it and sets ownership/permissions the main container’s non-root user needs — the Secret can’t be mounted directly with the right ownership, hence the extra copy step.
Networking
Service mosquitto is a LoadBalancer (MetalLB-assigned IP) exposing both 1883 and 9001 directly to the LAN — there is no Traefik ingress, since MQTT isn’t HTTP traffic.