Skip to content
Stand with Ukraine flag

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

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.

By default, you can log in as the developer user:

Terminal window
oc login -u developer -p developer

On first start-up, create the thingsboard project:

Terminal window
oc new-project thingsboard

Step 1. Clone ThingsBoard CE Kubernetes scripts

Section titled “Step 1. Clone ThingsBoard CE Kubernetes scripts”
Terminal window
git clone -b release-4.3.1.1 https://github.com/thingsboard/thingsboard-ce-k8s.git --depth 1
cd thingsboard-ce-k8s/openshift

Edit the .env file to set the database type:

Terminal window
nano .env

Set the DATABASE variable to one of:

ValueDescription
postgresUse PostgreSQL for all data
hybridUse PostgreSQL for entities and Cassandra for time-series data
  1. Run the installation script:

    Terminal window
    ./k8s-install-tb.sh --loadDemo

    The --loadDemo flag loads sample tenant account, dashboards, and devices for evaluation and testing.

  2. Deploy third-party resources:

    Terminal window
    ./k8s-deploy-thirdparty.sh

    Type yes when prompted if you are running ThingsBoard in high-availability deployment type for the first time or don’t have a configured Redis cluster.

  3. 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:

You can change passwords for each account in the account profile page.

See Getting Started for your next steps after login.

List running ThingsBoard node pods:

Terminal window
oc get pods -l app=tb-node

Stream logs of a specific pod:

Terminal window
oc logs -f TB_NODE_POD_NAME

Replace TB_NODE_POD_NAME with the pod name from the list above.

Other useful commands:

CommandDescription
oc get podsList all pods
oc get servicesList all services
oc get deploymentsList all deployments

See the oc Cheat Sheet for more commands.

Delete ThingsBoard microservices:

Terminal window
./k8s-delete-resources.sh

Delete third-party services:

Terminal window
./k8s-delete-thirdparty.sh

Delete all resources including database:

Terminal window
./k8s-delete-all.sh

Pull the latest changes from the repository:

Terminal window
git pull origin master

Then run the upgrade:

Terminal window
./k8s-delete-resources.sh
./k8s-upgrade-tb.sh
./k8s-deploy-resources.sh
  1. Upgrade to the latest CE version.

  2. Stop ThingsBoard resources:

    Terminal window
    ./k8s-delete-resources.sh
  3. Merge your configuration with the latest PE OpenShift scripts. Configure the license key as described in the PE OpenShift guide.

  4. Run the migration script:

    Terminal window
    ./k8s-upgrade-tb.sh --fromVersion=CE
  5. Deploy ThingsBoard resources:

    Terminal window
    ./k8s-deploy-resources.sh