Skip to content
Stand with Ukraine flag

Minikube

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

  • TBMQ × 2
  • Integration Executor
  • PostgreSQL
  • Kafka
  • Valkey

Node ports on the Minikube IP

  • 30001 HTTP TBMQ UI and REST API
  • 30002 MQTT MQTT clients
  • 30003 MQTTS MQTT clients that connect over TLS, once you enable the TBMQ SSL listener (LISTENER_SSL_ENABLED)
  • 30004 MQTT over WebSockets MQTT clients that connect over WebSockets
  • Minikube and kubectl installed, and a running Minikube cluster:

    Terminal window
    minikube start
  • Git installed.

Clone TBMQ K8S repository

Section titled Clone TBMQ K8S repository
Terminal window
git clone -b release-2.4.2 https://github.com/thingsboard/tbmq-pe-k8s.git
cd tbmq-pe-k8s/minikube

Run 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:

Terminal window
./k8s-install-tbmq.sh

The script creates the thingsboard-mqtt-broker namespace, starts PostgreSQL, Kafka, and Valkey, and installs the database. The output includes Installation finished successfully!.

Configure the license key

Section titled Configure the license key

Create a Kubernetes secret with your license key:

Terminal window
export TBMQ_LICENSE_KEY=YOUR_LICENSE_KEY_HERE
kubectl create -n thingsboard-mqtt-broker secret generic tbmq-license --from-literal=license-key=$TBMQ_LICENSE_KEY
  1. Deploy TBMQ.

    Terminal window
    ./k8s-deploy-tbmq.sh

    The 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.

  2. Open the UI.

    Get the Minikube IP:

    Terminal window
    minikube ip

    Open 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.

  3. Sign in as System Administrator.

    Use the default System Administrator credentials:

    Username
    sysadmin@thingsboard.org
    Password
    sysadmin
  4. Change 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-….

View TBMQ node logs
kubectl logs -f tbmq-0
View the state of the pods, services, deployments, and statefulsets
kubectl get pods
kubectl get services
kubectl get deployments
kubectl get statefulsets

See the kubectl Quick Reference for more details.

Delete the TBMQ nodes and the Integration Executor
./k8s-delete-tbmq.sh

PostgreSQL, Kafka, and Valkey keep running, and the data stays. ./k8s-deploy-tbmq.sh brings the TBMQ nodes and the Integration Executor back.

Delete all resources, including the databases (deletes all data)
./k8s-delete-all.sh

k8s-delete-all.sh keeps the tbmq-license secret, so skip Configure the license key when you install again.

  1. Check the version-specific notes below for any preparation your target version requires.
  2. Back up your database (optional but recommended).
  3. Run the upgrade commands.

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.

This is a standard upgrade from v2.4.0.

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.

This is a standard upgrade from v2.3.0.

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.

This is a standard upgrade from v2.2.0.

No third-party component changes are required — the official images are already in use since v2.2.0.

Proceed with the upgrade.

Upgrade from TBMQ to TBMQ PE

Section titled Upgrade from TBMQ to TBMQ PE

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.

  1. Clone the TBMQ PE repository.

    Clone it next to your TBMQ directory, as described in Clone TBMQ K8S repository.

  2. 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.

  3. Create the license secret.

    Create the tbmq-license secret as described in Configure the license key.

  4. Delete the TBMQ nodes.

    In the TBMQ tbmq/k8s/minikube directory, run:

    Terminal window
    ./k8s-delete-tbmq.sh

    The 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.

  5. Migrate the database and deploy TBMQ PE.

    In the PE tbmq-pe-k8s/minikube directory, run:

    Terminal window
    ./k8s-upgrade-tbmq.sh --fromVersion=ce
    ./k8s-deploy-tbmq.sh
  1. Switch to the new release branch.

    Terminal window
    git fetch origin release-2.4.2
    git checkout -m release-2.4.2

    git 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).

  2. Run the upgrade.

    Terminal window
    ./k8s-upgrade-tbmq.sh
    ./k8s-deploy-tbmq.sh

    k8s-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.

Connect your first client

Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.

Secure the broker

Choose the authentication provider that fits your clients. See Security overview.

Watch the broker

Track sessions, throughput, and resource usage as traffic grows. See Monitoring.