Cluster setup using Minikube
This guide walks you through setting up ThingsBoard Community Edition in cluster mode using Kubernetes and Minikube with microservices architecture.
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 ingressStep 1. Clone ThingsBoard CE Kubernetes scripts
Section titled “Step 1. Clone ThingsBoard CE Kubernetes scripts”git clone -b release-4.3.1.1 https://github.com/thingsboard/thingsboard-ce-k8s.git --depth 1cd thingsboard-ce-k8s/minikubeStep 2. Configure database
Section titled “Step 2. 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 3. Install and start ThingsBoard
Section titled “Step 3. 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”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.shMigration to Professional Edition
Section titled “Migration to Professional Edition”-
Upgrade to the latest CE version.
-
Stop ThingsBoard resources:
Terminal window ./k8s-delete-resources.sh -
Merge your configuration with the latest PE Minikube scripts. Configure the license key as described in the PE Minikube guide.
-
Run the migration script:
Terminal window ./k8s-upgrade-tb.sh --fromVersion=CE -
Deploy ThingsBoard resources:
Terminal window ./k8s-deploy-resources.sh