Stand with Ukraine flag
Try it now Pricing
Trendz Analytics
Installation > On premise > Kubernetes
Getting Started Documentation Guides
On this page

Installing ThingsBoard Trendz Analytics on Kubernetes

This guide describes how to setup Trendz Analytics cluster with Kubernetes and Minikube.

Prerequisites

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.

Configure your cluster by designating a node for the Trendz instance and labeling it with a custom label. Utilize affinity settings to instruct Kubernetes to deploy the Trendz instance on the specified node. Ensure that the node meets specific CPU and RAM requirements, with the typical usage being around 4 CPU and 8GB RAM. While you can set your own limits, we advise adhering to or exceeding the recommended specifications mentioned earlier.

Step 1 Clone Trendz Kubernetes scripts

1
2
git clone https://github.com/thingsboard/trendz-k8s.git --depth 1
cd trendz-k8s

Step 2. Obtain the license key

We assume you have already chosen subscription plan for Trendz and have license key. If not, please get your Free Trial license before you proceed. See How-to get pay-as-you-go subscription for more details.

Note: We will reference the license key you have obtained during this step as PUT_YOUR_LICENSE_SECRET_HERE later in this guide.

Step 3. Configure your license key

1
nano trendz-app-deployment.yml

and put the license secret parameter:

1
2
3
4
5
# tb-node StatefulSet configuration

- name: TRENDZ_LICENSE_SECRET
  value: "PUT_LICENSE_HERE"

Step 4 Configure Trendz database

Set up an external Postgresql database instance with an empty database named “trendz.” This instance can be hosted on services like RDS (AWS) or as your stateful deployment. Ensure you have the following information:

  • URL (Example: jdbc:postgresql://trendz-db-service:5432/trendz)
  • Username (Example: postgres)
  • Password (Example: postgres)

Now we can configure the Trendz database by editing the trendz-db-config.yml file:

1
nano trendz-app-db-config.yml
1
2
3
4
  SPRING_DATASOURCE_URL: jdbc:postgresql://trendz-db-service:5432/trendz
  SPRING_DATASOURCE_USERNAME: postgres
  SPRING_DATASOURCE_PASSWORD: postgres

Step 5 Connect Trendz to ThingsBoard service

We must set an url for connecting to ThingsBoard Rest API (for example https://my-tb.com). Note that ThingsBoard IP address or domain name should be resolvable from Trendz docker container

1
nano trendz-app-deployment.yml

And update TB_API_URL and :

1
2
3
4
- name: TB_API_URL
  value: "https://my-tb.com"
- name: JWT_TOKEN_SIGNING_KEY
  value: "myTbSignKey"

Step 4 Running

1
2
3
4
5
6
7
8
kubectl apply -f trendz-namespace.yml
kubectl apply -f trendz-app-config.yml
kubectl apply -f trendz-app-db-config.yml
kubectl apply -f trendz-app-pvc.yml
kubectl apply -f trendz-app-deployment.yml
kubectl apply -f trendz-python-executor-config.yml
kubectl apply -f trendz-python-executor-deployment.yml

Step 5 Check the logs

Now check the logs and be sure that the instance is started successfully. There should be a next line:

1
2
3
kubectl logs -f [trendz-pod-name]

Started TrendzApplication in 5.654 seconds (JVM running for 6.229)

Where:

  • trendz-pod-name - trendz pod name obtained from the list of the running trendz pods.

Step 6 Set up a load balancer

The last thing is to set up a load balancer to route requests to the Trendz instance. Just update your current load balancer config using reference from the trendz-ingress.yml file.

Do not apply this file, it is just an example. Different environments have different requirements for these configurations, so you need to adjust these settings to your environment.

Next steps

  • Getting started guide - These guide provide quick overview of main Trendz features.

  • Calculated Fields - Learn about Calculated fields and how to use them.

  • States - Learn how to define and analyse states for assets based on raw telemetry.

  • Prediction - Learn how to make forecasts and predict telemetry behavior.

  • Filters - Learn how filter dataset during analysis.

  • Available Visualizations - Learn about visualization widgets available in Trendz and how to configure them.

  • Share and embed Visualizations - Learn how to add Trendz visualizations on ThingsBoard dashboard or 3rd party web pages.