Connect your first client
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
This guide covers setting up TBMQ in cluster mode using Minikube.
The scripts deploy two TBMQ nodes, an Integration Executor, PostgreSQL, Kafka, and Valkey into the
thingsboard-mqtt-broker namespace. The TBMQ service is exposed on these node ports of the Minikube IP:
Minikube cluster
Node ports on the Minikube IP
LISTENER_SSL_ENABLED)
Minikube and kubectl installed, and a running Minikube cluster:
minikube startGit installed.
git clone -b release-2.4.2 https://github.com/thingsboard/tbmq-pe-k8s.gitcd tbmq-pe-k8s/minikubeRun every command in this guide from this tbmq-pe-k8s/minikube directory.
Before proceeding, ensure you have an active TBMQ license. If you don’t have one yet, visit the Pricing page, choose a pay-as-you-go subscription or a perpetual license, and use the calculator to size your deployment — session and throughput limits, production and development instances, and any add-ons — to obtain your license key.
Run the installation script:
./k8s-install-tbmq.shThe script creates the thingsboard-mqtt-broker namespace, starts PostgreSQL, Kafka, and Valkey, and installs the
database. The output includes Installation finished successfully!.
Create a Kubernetes secret with your license key:
export TBMQ_LICENSE_KEY=YOUR_LICENSE_KEY_HEREkubectl create -n thingsboard-mqtt-broker secret generic tbmq-license --from-literal=license-key=$TBMQ_LICENSE_KEYDeploy TBMQ.
./k8s-deploy-tbmq.shThe TBMQ nodes start one after another, so the deployment can take a few minutes. All pods are ready when every row
of kubectl get pods shows 1/1 in the READY column.
Open the UI.
Get the Minikube IP:
minikube ipOpen http://{minikube-ip}:30001 in your browser (e.g., http://192.168.49.2:30001). You should see the TBMQ
login page. MQTT clients connect to the same IP on port 30002.
Sign in as System Administrator.
Use the default System Administrator credentials:
sysadmin@thingsboard.orgsysadminChange the default password.
On first login, you are prompted to change the default password and re-login with the new credentials.
The scripts create these pods: tbmq-0 and tbmq-1 (TBMQ nodes), tbmq-integration-executor-0, postgres-…,
tbmq-kafka-0, and tbmq-valkey-….
kubectl logs -f tbmq-0kubectl get podskubectl get serviceskubectl get deploymentskubectl get statefulsetsSee the kubectl Quick Reference for more details.
./k8s-delete-tbmq.shPostgreSQL, Kafka, and Valkey keep running, and the data stays. ./k8s-deploy-tbmq.sh brings the TBMQ nodes and the
Integration Executor back.
./k8s-delete-all.shk8s-delete-all.sh keeps the tbmq-license secret, so skip Configure the license key
when you install again.
For full version history and supported upgrade paths, see the upgrade instructions page. If the documentation does not cover your specific upgrade path, contact us for guidance.
What each upgrade needs before you run the upgrade — select a version for its full notes:
| Upgrade to | Before running the upgrade |
|---|---|
| 2.4.2 | Nothing. Check SCRAM-only authentication and Kafka integrations |
| 2.4.1 | Nothing. If you set MQTT_TOPIC_MAX_SEGMENTS_COUNT, raise it by 1 |
| 2.4.0 | Nothing. If you scrape metrics, update queries for the renamed Prometheus metrics |
| 2.3.0 | Delete the TBMQ pods first |
| TBMQ to TBMQ PE | Move to the PE repository and set the license key; this path has its own commands |
Backing up your PostgreSQL database before upgrading is highly recommended but optional. For guidance, follow the backup and restore instructions.
This is a standard upgrade from v2.4.1. No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.
Proceed with the upgrade.
No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.
Proceed with the upgrade.
No third-party component changes are required.
The upgrade creates the dropped_msg table used by dropped message analytics; no existing table is altered and no data
is migrated.
Proceed with the upgrade.
No third-party component changes are required — the official images are already in use since v2.2.0.
Proceed with the upgrade.
CE-to-PE migration is supported for the same version only. If you are on an earlier CE version, upgrade TBMQ CE to the latest version first. For all supported paths, see the upgrade instructions.
TBMQ PE uses its own repository, so the migration moves your deployment from the TBMQ tbmq/k8s/minikube directory to
the PE tbmq-pe-k8s/minikube directory. PostgreSQL, Kafka, Valkey, and their data stay the same.
Clone the TBMQ PE repository.
Clone it next to your TBMQ directory, as described in Clone TBMQ K8S repository.
Carry over your settings.
Copy your own changes from the TBMQ directory into the matching PE files, such as tbmq.yml,
tbmq-configmap.yml, and tbmq-ie.yml. Keep the PE image names and the license settings in the PE tbmq.yml.
Create the license secret.
Create the tbmq-license secret as described in Configure the license key.
Delete the TBMQ nodes.
In the TBMQ tbmq/k8s/minikube directory, run:
./k8s-delete-tbmq.shThe PE tbmq statefulset adds a volume for the license data, which Kubernetes can’t add to an existing statefulset,
so the TBMQ one must be deleted first. PostgreSQL, Kafka, and Valkey keep running.
Migrate the database and deploy TBMQ PE.
In the PE tbmq-pe-k8s/minikube directory, run:
./k8s-upgrade-tbmq.sh --fromVersion=ce./k8s-deploy-tbmq.shSwitch to the new release branch.
git fetch origin release-2.4.2git checkout -m release-2.4.2git checkout -m switches to the release branch and keeps your own edits to files such as tbmq.yml and
tbmq-configmap.yml. Make sure the TBMQ images in tbmq.yml, tbmq-ie.yml, and database-setup.yml use the
target version (e.g., 2.4.2).
Run the upgrade.
./k8s-upgrade-tbmq.sh./k8s-deploy-tbmq.shk8s-upgrade-tbmq.sh upgrades the database but does not touch the TBMQ pods — they keep running the previous image
until k8s-deploy-tbmq.sh applies the updated manifests. Kubernetes then replaces the TBMQ pods one at a time, each
after the previous one is ready.
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
Choose the authentication provider that fits your clients. See Security overview.
Change broker settings through environment variables in tbmq.yml.
See How to change configuration.
Track sessions, throughput, and resource usage as traffic grows. See Monitoring.
Was this helpful?