thingsboard-cluster

by amykolaichuk

Helm chartv0.2.26App 3.6.0Apache-2.0Verified publisher

Helm chart for Thingsboard cluster.

About this chart

Thingsboard helm chart

ThingsBoard is an open-source IoT platform that enables rapid development, management, and scaling of IoT projects.

More details about Thingsboard

Prerequisites

  • Kubernetes 1.12+
  • Helm 3+
  • PV provisioner support in the underlying infrastructure
  • License Key - if you plan to use Thingsboard PE

Introduction

Get Your ThingsBoard Up and Running on Kubernetes

This guide helps you set up ThingsBoard, an open-source platform for managing Internet of Things (IoT) devices, on a Kubernetes cluster. We'll use Helm, a popular package manager for Kubernetes, to streamline the process.

What is ThingsBoard?

ThingsBoard lets you quickly develop, manage, and scale your IoT projects. It's a great choice if you're working with connected devices and want an easy way to get started.

Deployment Options

There are two main ways to deploy ThingsBoard on Kubernetes:

  • Monolith: This is a simpler setup where all the components of ThingsBoard run together with a PostgreSQL database. It's a good option for smaller projects or getting started.
  • Microservices: This more complex setup breaks ThingsBoard down into smaller, independent services. This makes it easier to scale different parts of the system as needed and handle large amounts of data. Microservices require additional software like Kafka for queuing messages, Zookeeper for coordinating services, and Redis for caching data.

NOTE: Thingsboard by itself supports various services for queue , cache, but this chart for now supports only services noticed above.

Choosing a Database

ThingsBoard can use either PostgreSQL or a combination of PostgreSQL and Cassandra. Cassandra is a good option if you expect to manage a massive amount of data.

Want to Learn More?

For detailed instructions on setting up ThingsBoard in either configuration, refer to the official documentation:

Community Edition (CE) Professional Edition (PE)

Using Third Party Services with ThingsBoard

This Helm chart for ThingsBoard lets you integrate with several third-party services, including Kafka, Cassandra, Redis, and Zookeeper. You have two options for these services:

1 Internal Deployments (Managed by this Chart)

This option allows you to easily deploy these services alongside ThingsBoard using official Bitnami charts as sub-charts. These charts are pre-configured for quick setup. Here are the available services:

Redis Redis Cluster Cassandra PostgreSQL Kafka Zookeeper

You can customize these internal deployments using prefixes in your configuration file. Here's a table summarizing the prefixes:

Service NamePrefix
RedisinternalRedis
KafkainternalKafka
CassandrainternalCassandra
ZookeeperinternalZookeeper
PostgreSQLinternalPostgresql

By default, all internal deployments are enabled. Here's an example of how to configure storage size for the internal Kafka deployment:

internalKafka:
  persistence:
    size: 35Gi

2 External Deployments (Pre-Existing Services)

This option is for situations where you already have these services deployed and configured elsewhere. You can still use this chart to connect ThingsBoard to your existing services. All external service configurations take priority over internal ones. Here's a table showing the prefixes for external services:

Service NamePrefix
RedisexternalRedis
KafkaexternalKafka
CassandraexternalCassandra
ZookeeperexternalZookeeper
PostgreSQLexternalPostgresql

For more details about configuration options, please refer to the "Parameters" section of the documentation.

[!WARNING]
If you're going to use internal third party services please don`t use them in production mode before configuring them. For configuration you can use Official bitnami docs

Installing the Chart

Here's how to install the ThingsBoard cluster chart:

Add the Repository:

helm repo add thingsboard-cluster-betta https://mykolaichukalexander.github.io/thingsboard-cluster-chart/

This command adds the thingsboard-cluster-betta repository to your Helm repositories.

Install the Chart:

helm install my-thingsboard-cluster thingsboard-cluster-betta/thingsboard-cluster --version 0.1.0

This command installs the ThingsBoard cluster using the thingsboard-cluster chart from the thingsboard-cluster-betta repository. It gives the release the name my-thingsboard-cluster and sets the version to 0.1.0.

This command installs the ThingsBoard cluster with the following specifications:

  • Release name: my-thingsboard-cluster
  • Chart version: 0.1.0
  • Default configuration:
    • Microservices (MSA) architecture;
    • Community Edition (CE) - 1 Tb-Core and 1 Tb-Rule-Engine;
    • Messaging and caching services: Kafka;
    • Cache: Redis;
    • Service Coordination: Zookeeper;
    • Database: PostgreSQL.

Uninstalling ThingsBoard

To uninstall the ThingsBoard cluster, use the following command:

helm delete my-thingsboard-cluster -n namespace

This command removes all the ThingsBoard components associated with the chart (release named my-thingsboard-cluster) from the specified namespace (namespace).

Important Note:

The helm delete command removes the logical resources of the ThingsBoard cluster. To completely remove all persistent data, you may need to additionally delete the Persistent Volume Claims (PVCs) after uninstallation.

kubectl delete pvc -l release=my-thingsboard-cluster

This command deletes all PVCs with the label release=my-thingsboard-cluster.

Parameters

Installation Parameters

NameDescriptionValue
installation.msaThingsboard architecture Type. Thingsboard can run in two different configurations. To decide in what configuration you should run your cluster please visit https://thingsboard.io/docs/pe/reference/#monolithic-vs-microservices-architecture.true
installation.installTbThis field is responsible for the installation process of Thingsboard. The installation process will create all needed databases tables (in PostgreSQL in case of only "Postgres Mode" for Timeseries. Or in PostgreSQL and Cassandra in the case of "hybrid mode". For more information on how to choose the most suitable option for you please visit https://thingsboard.io/docs/pe/reference/#sql-vs-nosql-vs-hybrid-database-approach.false
installation.loadDemoWorks only with installation.installTb: true. This option will load into database some prepared data for you.false
installation.peSwitch on Professional Edition mode. For more information please visit https://thingsboard.io/docs/getting-started-guides/helloworld-pe/.false
installation.licenseKeyIf you plan to use the Professional Edition version of Thingsboard you need to provide this key. You can get this key from Thingsboard team. In the case of Community Edition, you can skip this field empty.""
dockerAuth.registryDocker registry for Thingsboard images"https://index.docker.io/v1/"
dockerAuth.usernameDocker username on which pull secret will be created""
dockerAuth.passwordDocker user password on which pull secret will be created""

Global Parameters

NameDescriptionValue
global.imagePullSecretGlobal Docker registry secret nameregcred

Thingsboard Node Parameters

This node category will use to configure Thingsboard node in monolith mode or core in MSA mode.

NameDescriptionValue
node.image.repositoryRepository option that has the highest priority and will override global.repositorythingsboard/tb-node
node.image.tagTag option that has the highest priority and will override global.tagChart Application Version
node.imagePullPolicyNode/core pull policy for imageAlways
node.statefulSet.replicasReplica count for node(core) services1
node.ports

Deploy thingsboard-cluster with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has thingsboard-cluster on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartthingsboard-cluster is pinned at v0.2.26 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply