Star

Installation

Documentation for installation and configuration of ThingsBoard IoT Platform.

ThingsBoard Professional Edition cluster setup with Kubernetes and Minikube guide

This guide will help you to setup ThingsBoard in cluster mode with Kubernetes and Minikube. For this purpose, we will use docker container images available on Docker Hub.

Prerequisites

ThingsBoard Microservices run on the Kubernetes cluster. 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.

Step 1. Checkout all ThingsBoard PE Images

Please checkout all ThingsBoard PE Images from Docker Hub. You will need to open all verified images and click on “Proceed to checkout” to accept ThingsBoard PE license agreement.

Listing all images mandatory for checkout for your convenience below:

image

Populate basic information about yourself and click “Get Content”

image

Step 2. Upload Docker credentials

Make sure your have logged in to docker hub using command line. To upload Docker credentials, please execute next command:

$ ./k8s-upload-docker-credentials.sh

Step 3. Clone ThingsBoard PE Kubernetes scripts

git clone https://github.com/thingsboard/thingsboard-pe-k8s.git

In .env file set the value of PLATFORM field to minikube.

Step 4. Obtain your license key

We assume you have already chosen your subscription plan or decided to purchase a perpetual license. If not, please navigate to pricing page to select the best license option for your case and get your license. See How-to get pay-as-you-go subscription or How-to get perpetual license for more details.

IMPORTANT NOTE: Make sure you have purchased a license key for at least two instances of ThingsBoard PE. Otherwise you need to modify local copy of docker-compose.yml to use only one ThingsBoard instance. We will reference the license key you have obtained during this step as PUT_YOUR_LICENSE_SECRET_HERE later in this guide.

Step 5. Configure your license key

cd thingsboard-pe-k8s
nano common/tb-node.yml

and put the license secret parameter

# tb-node StatefulSet configuration

- name: TB_LICENSE_SECRET
  value: "PUT_YOUR_LICENSE_SECRET_HERE"

Step 6. Review the architecture page

Starting ThingsBoard v2.2, it is possible to install ThingsBoard cluster using new microservices architecture and docker containers. See microservices architecture page for more details.

Step 7. Configure Minikube

By default ingress addon is disabled in the Minikube, and available only in cluster providers. To enable ingress, please execute the following command:

$ minikube addons enable ingress

Step 8. Configure ThingsBoard database

Before performing initial installation you can configure the type of database to be used with ThingsBoard. In order to set database type change the value of DATABASE variable in .env file to one of the following:

NOTE: According to the database type corresponding kubernetes resources will be deployed (see common/postgres.yml, common/cassandra.yml for details).

Step 9. Choose deployment type

Before performing initial installation you can configure the type of ThingsBoard deployment. In order to set deployment type change the value of DEPLOYMENT_TYPE variable in .env file to one of the following:

NOTE: According to the deployment type corresponding kubernetes resources will be deployed (see the content of the directories basic and high-availability for details).

Step 10. Running

Execute the following command to run installation:

$ ./k8s-install-tb.sh --loadDemo

Where:

Execute the following command to deploy third-party resources:

$ ./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 configured Redis cluster.

Execute the following command to deploy ThingsBoard resources:

$ ./k8s-deploy-resources.sh

After a while when all resources will be successfully started you can open http://{your-cluster-ip} in your browser (for ex. http://192.168.99.101). You can see your cluster IP using command:

$ minikube ip You should see ThingsBoard login page.

Use the following default credentials:

If you installed DataBase with demo data (using --loadDemo flag) you can also use the following credentials:

n case of any issues you can examine service logs for errors. For example to see ThingsBoard node logs execute the following command:

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

$ kubectl get pods -l app=tb-node

2) Fetch logs of the tb-node pod:

$ kubectl logs -f [tb-node-pod-name]

Where:

Or use kubectl get pods to see the state of all the pods. Or use kubectl get services to see the state of all the services. Or use kubectl get deployments to see the state of all the deployments. See kubectl Cheat Sheet command reference for details.

Execute the following command to delete all ThingsBoard microservices:

$ ./k8s-delete-resources.sh

Execute the following command to delete all third-party microservices:

$ ./k8s-delete-thirdparty.sh

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

$ ./k8s-delete-all.sh

Upgrading

In case when database upgrade is needed, execute the following commands:

$ ./k8s-delete-resources.sh
$ ./k8s-upgrade-tb.sh --fromVersion=[FROM_VERSION]
$ ./k8s-deploy-resources.sh

Where:

Next steps