Get the latest tech news

High Available Mosquitto MQTT on Kubernetes


Raymii.orgQuis custodiet ipsos custodes? Home | About | All pages | Cluster Status | RSS Feed High Available Mosquitto MQTT on Kubernetes Published: 14-05-2025 22:11 | Author: Remy van Elst | Text only version of this article Table of Contents - Summary - Why the Mosquitto Failover Pod Needs a Service Account - How the Mosquitto Failover Pod Keeps the MQTT Service Alive - What happens when the primary node is down? - K8S Deployment YAML file - Traefik Helm Chart Config for k3s In this post, we'll walk through a fully declarative, Kubernetes-native setup for running a highly available MQTT broker using Eclipse Mosquitto. This configuration leverages core Kubernetes primitives ( Deployments, Services, ConfigMaps, and RBAC), alongside Traefik IngressRouteTCP to expose MQTT traffic externally.

This configuration leverages core Kubernetes primitives ( Deployments, Services, ConfigMaps, and RBAC), alongside Traefik IngressRouteTCP to expose MQTT traffic externally. The big advantage over a single Pod deployment (which, in case of node failure, k8s will restart after 5 minutes) is that this setup has a downtime of only 5 seconds and shared state, so all messages will be available on a failover. The configuration presented here avoids that downtime by deploying both a primary and secondary Mosquitto broker, each in its own pod, scheduled on different nodes and using a custom failover controller to handle traffic redirection.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Kubernetes

Kubernetes

Related news:

News photo

Replacing Kubernetes with systemd (2024)

News photo

Show HN: Kubetail – Real-time log search for Kubernetes

News photo

Cast AI raises $108M to get the most out of AI, Kubernetes, and other workloads