This guide will help you to setup ThingsBoard in cluster mode in AWS EKS.
ThingsBoard Microservices run on the Kubernetes cluster. You need to install a terraform (v0.12+) and the kubectl (v1.16+).
terraform - for create and manage cloud infrastructure in AWS EKS.
You can choose any other available Kubernetes cluster deployment solutions.
Also you need access to AWS. It can be iam user or iam role. You need have a AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY. To add environment variables, please execute the following command:
To initialize a working directory for terraform, please execute the following command:
To create configure file for terraform, please execute the following command:
And add this example config:
cluster_name = "k8s-cluster-example" aws_region = "eu-west-1" worker_type = "t3.medium" cluster_version = "1.17"
Now we use this example config, but you can see all the variables in
To see what infrastructure will be created, please execute the following command:
To create this infrastructure, please execute the following command:
We will get cluster_name from the output of this command. And after executing this command we will have the k8s cluster.
To set KUBECONFIG variable for kubectl, please execute the following command:
And check your nodes in the cluster:
kubectl get nodes
To scale your nodes you need to install “cluster_autoscaler”. Please, change “cluster_name” in
and please execute the following command for install “cluster_autoscaler”:
kubectl apply -f ../../common/cluster-autoscaler-autodiscover.yaml
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.
Please go to back in root folder
.env file set the value of
PLATFORM field to
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:
postgres- use PostgreSQL database;
hybrid- use PostgreSQL for entities database and Cassandra for timeseries database;
NOTE: According to the database type corresponding kubernetes resources will be deployed (see
high-availability/postgres-ha.yaml for postgres with replication,
common/cassandra.yml for details).
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:
basic- startup with a single instance of Zookeeper, Kafka and Redis;
high-availability- startup with Zookeeper, Kafka, and Redis in cluster modes;
NOTE: According to the deployment type corresponding kubernetes resources will be deployed (see the content of the directories
high-availability for details).
If you selected
DATABASE you can also configure the number of Cassandra nodes (
StatefulSet.spec.replicas property in
common/cassandra.yml config file) and the
It is recommended to have 3 Cassandra nodes with
CASSANDRA_REPLICATION_FACTOR equal to 1.
NOTE: If you want to configure
CASSANDRA_REPLICATION_FACTOR please read Cassandra documentation first.
Also, to run PostgreSQL in
high-availability deployment mode you’ll need to install
Execute the following command to run installation:
--loadDemo- optional argument. Whether to load additional demo data.
Execute the following command to deploy third-party resources:
Type ‘yes’ when prompted, if you are running ThingsBoard in
DEPLOYMENT_TYPE for the first time or don’t have configured Redis cluster.
Execute the following command to deploy ThingsBoard resources:
After a while when all resources will be successfully started you can open ThingsBoard web interface in your browser using ip of the load balancer.
You can see ip of the loadbalancer using command:
kubectl get ingress -oyaml
Or you can see this name on the GCP LB page.
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:
In 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
tb-node-pod-name- tb-node pod name obtained from the list of the running tb-node pods.
kubectl get pods to see the state of all the pods.
kubectl get services to see the state of all the services.
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:
Execute the following command to delete all third-party microservices:
Execute the following command to delete all resources (including database):
To remove k8s cluster and aws resources, you can execute the following command:
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
FROM_VERSION- from which version upgrade should be started. See Upgrade Instructions for valid
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards.
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Advanced features - Learn about advanced ThingsBoard features.
Contribution and Development - Learn about contribution and development in ThingsBoard.