Stand with Ukraine flag
Try it now Pricing
MQTT Broker
Installation > Cluster setup with Kubernetes on Minikube
Getting Started Documentation
Architecture API FAQ
On this page

Cluster setup using Minikube

This guide will help you to set up TBMQ in cluster mode using Minikube.

Prerequisites

You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you don’t have Minikube installed, please follow these instructions. Additionally, you will need helm to be installed.

Step 1. Clone TBMQ repository

1
2
git clone -b release-1.4.0 https://github.com/thingsboard/tbmq.git
cd tbmq/k8s/minikube

Step 2. Installation

To install TBMQ execute the following command:

1
./k8s-install-tbmq.sh

Step 3. Running

Execute the following command to deploy TBMQ:

1
./k8s-deploy-tbmq.sh

After a while when all resources will be successfully started you can open http://{your-cluster-ip}:30001 in your browser (e.g. http://192.168.49.2:30001). You can check your cluster IP using command:

1
minikube ip

You should see TBMQ login page. Use the following default credentials for System Administrator:

Username:

1
sysadmin@thingsboard.org

Password:

1
sysadmin

On the first user log-in you will be asked to change the default password to the preferred one and then re-login using the new credentials.

Step 4. Logs, delete statefulsets and services

In case of any issues, you can examine service logs for errors. For example to see TBMQ node logs execute the following commands:

1) Get the list of the running tb-broker pods:

1
kubectl get pods -l app=tb-broker

2) Fetch logs of the tb-broker pod:

1
kubectl logs -f TB_BROKER_POD_NAME

Where:

  • TB_BROKER_POD_NAME - tb-broker pod name obtained from the list of the running tb-broker pods.

Or use the next command to see the state of all the pods.

1
kubectl get pods

Use the next command to see the state of all the services.

1
kubectl get services

Use the next command to see the state of all the deployments.

1
kubectl get deployments

Use the next command to see the state of all the statefulsets.

1
kubectl get statefulsets

See kubectl Cheat Sheet command reference for more details.

Execute the following command to delete TBMQ nodes:

1
./k8s-delete-tbmq.sh

Execute the following command to delete all resources (including database):

1
./k8s-delete-all.sh

Upgrading

Doc info icon

Please note:
For the TBMQ 1.3.0 version, the installation scripts were updated to contain a new 8084 port for MQTT over WebSockets. This is needed for the correct work with the WebSocket client page.

Please pull the latest configuration files or modify your existing ones to include a new port entry. To find more details please visit the following link.

Once the required changes are made, you should be able to connect the MQTT client on the WebSocket client page. Otherwise, please contact us, so we can answer any questions and provide our help if needed.

In case you would like to upgrade, please pull the recent changes from the latest release branch:

1
git pull origin release-1.4.0

Note: Make sure custom changes of yours if available are not lost during the merge process.

If you encounter conflicts during the merge process that are not related to your changes, we recommend accepting all the new changes from the remote branch.

You could revert the merge process by executing the following:

1
git merge --abort

And repeat the merge by accepting theirs changes.

1
git pull origin release-1.4.0 -X theirs

There are several useful options for the default merge strategy:

  • -X ours - this option forces conflicting hunks to be auto-resolved cleanly by favoring our version.
  • -X theirs - this is the opposite of ours. See more details here.

After that execute the following commands:

1
2
3
./k8s-delete-tbmq.sh
./k8s-upgrade-tbmq.sh --fromVersion=FROM_VERSION
./k8s-deploy-tbmq.sh

Where FROM_VERSION - from which version upgrade should be started. See Upgrade Instructions for valid fromVersion values.

Next steps