Cluster setup using OpenShift
This guide walks you through setting up ThingsBoard Community Edition in cluster mode using OpenShift with microservices architecture.
For a simpler single-node installation, see Docker (Linux, macOS).
Prerequisites
Section titled “Prerequisites”ThingsBoard microservices run on a Kubernetes cluster. To deploy an OpenShift cluster locally you need Docker CE and OpenShift Origin. Follow these instructions to install all required software.
Log in to OpenShift cluster
Section titled “Log in to OpenShift cluster”By default, you can log in as the developer user:
oc login -u developer -p developerCreate project
Section titled “Create project”On first start-up, create the thingsboard project:
oc new-project thingsboardStep 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/openshiftStep 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
To find your ThingsBoard application URL, log in as the developer user (default password: developer), open the thingsboard project, then navigate to Application → Routes. The root route should look like https://tb-route-node-root-thingsboard.127.0.0.1.nip.io/.
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:
oc get pods -l app=tb-nodeStream logs of a specific pod:
oc logs -f TB_NODE_POD_NAMEReplace TB_NODE_POD_NAME with the pod name from the list above.
Other useful commands:
| Command | Description |
|---|---|
oc get pods | List all pods |
oc get services | List all services |
oc get deployments | List all deployments |
See the oc 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 OpenShift scripts. Configure the license key as described in the PE OpenShift guide.
-
Run the migration script:
Terminal window ./k8s-upgrade-tb.sh --fromVersion=CE -
Deploy ThingsBoard resources:
Terminal window ./k8s-deploy-resources.sh