Cluster setup using Minikube
This guide walks you through setting up ThingsBoard Professional Edition in cluster mode using Kubernetes and Minikube with microservices architecture. Docker container images are available on Docker Hub.
For a simpler single-node installation, see Docker (Linux, macOS). For production cluster deployments, see Docker Compose (Cluster).
Prerequisites
Section titled “Prerequisites”ThingsBoard microservices run on a Kubernetes cluster. You need:
- Minikube installed
kubectlcommand-line tool configured to communicate with your cluster
Enable ingress addon
Section titled “Enable ingress addon”By default the ingress addon is disabled in Minikube. Enable it:
minikube addons enable ingressPull ThingsBoard PE images
Section titled “Pull ThingsBoard PE images”Verify that you can pull the images from Docker Hub:
docker pull thingsboard/tb-pe-node:4.3.1.1PEdocker pull thingsboard/tb-pe-web-report:4.3.1.1PEdocker pull thingsboard/tb-pe-web-ui:4.3.1.1PEdocker pull thingsboard/tb-pe-js-executor:4.3.1.1PEdocker pull thingsboard/tb-pe-http-transport:4.3.1.1PEdocker pull thingsboard/tb-pe-mqtt-transport:4.3.1.1PEdocker pull thingsboard/tb-pe-coap-transport:4.3.1.1PEdocker pull thingsboard/tb-pe-lwm2m-transport:4.3.1.1PEdocker pull thingsboard/tb-pe-snmp-transport:4.3.1.1PEStep 1. Clone ThingsBoard PE Kubernetes scripts
Section titled “Step 1. Clone ThingsBoard PE Kubernetes scripts”git clone -b release-4.3.1.1 https://github.com/thingsboard/thingsboard-pe-k8s.git --depth 1cd thingsboard-pe-k8s/minikubeStep 2. Obtain and configure the license key
Section titled “Step 2. Obtain and configure the license key”We assume you have already chosen your subscription plan or decided to purchase a perpetual license. If not, navigate to the pricing page to select the best license option for your case. See How to get a pay-as-you-go subscription or How to get a perpetual license for details.
Edit the ThingsBoard node configuration:
nano tb-node.ymlFind the TB_LICENSE_SECRET environment variable and replace PUT_YOUR_LICENSE_SECRET_HERE with your actual license secret:
- name: TB_LICENSE_SECRET value: "PUT_YOUR_LICENSE_SECRET_HERE"Step 3. Configure database
Section titled “Step 3. Configure database”Edit the .env file to set the database type:
nano .envSet the DATABASE variable to one of:
| Value | Description |
|---|---|
postgres | Use PostgreSQL for all data |
hybrid | Use PostgreSQL for entities and Cassandra for time-series data |
Step 4. Configure Trendz Analytics (optional)
Section titled “Step 4. Configure Trendz Analytics (optional)”You may optionally install Trendz Analytics.
Pull Trendz images
Section titled “Pull Trendz images”docker pull thingsboard/trendz:1.15.1docker pull thingsboard/trendz-python-executor:1.15.1Create Trendz database
Section titled “Create Trendz database”Edit trendz/trendz-secret.yml and replace YOUR_RDS_ENDPOINT_URL and YOUR_RDS_PASSWORD, then apply:
kubectl apply -f ./trendz/trendz-secret.ymlkubectl apply -f ./trendz/trendz-create-db.ymlCheck the logs:
kubectl logs job/trendz-create-db -n thingsboardDeploy Trendz
Section titled “Deploy Trendz”./k8s-deploy-trendz.shYou should see Trendz installed successfully! in the console output.
Step 5. Install and start ThingsBoard
Section titled “Step 5. Install and start ThingsBoard”-
Run the installation script:
Terminal window ./k8s-install-tb.sh --loadDemoThe
--loadDemoflag loads sample tenant account, dashboards, and devices for evaluation and testing. -
Deploy third-party resources:
Terminal window ./k8s-deploy-thirdparty.shType yes when prompted if you are running ThingsBoard in
high-availabilitydeployment type for the first time or don’t have a configured Redis cluster. -
Deploy ThingsBoard resources:
Terminal window ./k8s-deploy-resources.sh
After all resources start, get the cluster IP:
minikube ipOpen http://{your-cluster-ip} in your browser. You should see the ThingsBoard login page. Use the following default credentials:
- System Administrator: [email protected] / sysadmin
- Tenant Administrator: [email protected] / tenant
- Customer User: [email protected] / customer
You can change passwords for each account in the account profile page.
See Getting Started for your next steps after login.
Inspect logs and manage resources
Section titled “Inspect logs and manage resources”List running ThingsBoard node pods:
kubectl get pods -l app=tb-nodeStream logs of a specific pod:
kubectl logs -f TB_NODE_POD_NAMEReplace TB_NODE_POD_NAME with the pod name from the list above.
Other useful commands:
| Command | Description |
|---|---|
kubectl get pods | List all pods |
kubectl get services | List all services |
kubectl get deployments | List all deployments |
See the kubectl Cheat Sheet for more commands.
Cleanup
Section titled “Cleanup”Delete ThingsBoard microservices:
./k8s-delete-resources.shDelete third-party services:
./k8s-delete-thirdparty.shDelete all resources including database:
./k8s-delete-all.shUpgrading
Section titled “Upgrading”Upgrading ThingsBoard
Section titled “Upgrading ThingsBoard”Pull the latest changes from the repository:
git pull origin masterThen run the upgrade:
./k8s-delete-resources.sh./k8s-upgrade-tb.sh./k8s-deploy-resources.shUpgrading Trendz
Section titled “Upgrading Trendz”Pull the latest changes and run the upgrade:
git pull origin master./k8s-upgrade-trendz.sh