Skip to content
Stand with Ukraine flag

GCP

This guide covers deploying a TBMQ cluster on Google Kubernetes Engine (GKE) with the TBMQ Kubernetes scripts.

The scripts deploy two TBMQ broker nodes and two Integration Executors. TBMQ stores its data in Cloud SQL for PostgreSQL, Google Cloud Managed Service for Apache Kafka, and Memorystore for Valkey, which you create with the gcloud CLI. Web traffic goes through a Google Cloud Application Load Balancer, created from a GKE Ingress, and MQTT traffic through a passthrough Network Load Balancer, created from a Kubernetes Service.

GKE cluster

  • TBMQ × 2
  • Integration Executor × 2

Google Cloud managed services

  • Cloud SQL for PostgreSQL
  • Managed Service for Apache Kafka
  • Memorystore for Valkey

Load balancer ports

  • 80 HTTP · Application LB TBMQ UI and REST API
  • 443 HTTPS · Application LB TBMQ UI and REST API, with the HTTPS load balancer
  • 1883 MQTT · Network LB MQTT clients
  • 8084 MQTT over WebSockets · Network LB MQTT clients that connect over WebSockets
  • 8883 MQTTS · Network LB MQTT clients that connect over TLS, once you enable MQTTS in TBMQ
  • 8085 MQTT over secure WebSockets · Network LB MQTT clients that connect over secure WebSockets, once you enable MQTTS in TBMQ

Install the following tools:

Your Google Cloud account needs permission to create GKE clusters, Cloud SQL instances, Managed Kafka clusters, Memorystore instances, service accounts and their keys, and to grant IAM roles in the project.

Terminal window
git clone -b release-2.4.2 https://github.com/thingsboard/tbmq.git
cd tbmq/k8s/gcp

Run every command in this guide from this directory.

Create a Google Cloud project (recommended) or choose an existing one, then sign in and select it:

Terminal window
gcloud init

Enable the APIs this guide uses:

Terminal window
gcloud services enable container.googleapis.com \
sqladmin.googleapis.com servicenetworking.googleapis.com \
managedkafka.googleapis.com memorystore.googleapis.com \
networkconnectivity.googleapis.com

The commands in this guide read these variables. Set them in the shell you run the guide from; if you open a new shell, set them again:

Terminal window
export GCP_PROJECT=$(gcloud config get-value project)
export GCP_REGION=us-central1
export GCP_ZONE1=us-central1-a
export GCP_ZONE2=us-central1-b
export GCP_ZONE3=us-central1-c
export GCP_NETWORK=default
export TB_CLUSTER_NAME=tbmq-cluster
export TB_DATABASE_NAME=tbmq-db
export TB_KAFKA_NAME=tbmq-kafka
export TB_VALKEY_NAME=tbmq-valkey
echo "Project: $GCP_PROJECT, region: $GCP_REGION, network: $GCP_NETWORK"
echo "Zones: $GCP_ZONE1,$GCP_ZONE2,$GCP_ZONE3"

Where:

  • GCP_PROJECT: the project selected in your gcloud configuration.
  • GCP_REGION and GCP_ZONE1–GCP_ZONE3: a compute region and three of its zones. Every resource in this guide is created in this region.
  • GCP_NETWORK: the VPC network, default for the network every new project has. Its subnet in each region is also named default; if you use another network, the commands below that name the subnet use $GCP_NETWORK too, so give the subnet the same name or edit those commands.
  • TB_CLUSTER_NAME, TB_DATABASE_NAME, TB_KAFKA_NAME, TB_VALKEY_NAME: the names of the GKE cluster, the Cloud SQL instance, the Kafka cluster, and the Valkey instance.

Create a regional cluster with one e2-standard-4 node in each of the three zones. To size the nodes for production, change --machine-type and --num-nodes; see machine families.

Terminal window
gcloud container clusters create $TB_CLUSTER_NAME \
--release-channel stable \
--region $GCP_REGION \
--network=$GCP_NETWORK \
--node-locations $GCP_ZONE1,$GCP_ZONE2,$GCP_ZONE3 \
--enable-ip-alias \
--num-nodes=1 \
--node-labels=role=main \
--machine-type=e2-standard-4

This takes about 10 minutes. When it finishes, gcloud adds the cluster to your kubeconfig and switches the current context to it. To get the credentials again later, for example on another machine:

Terminal window
gcloud container clusters get-credentials $TB_CLUSTER_NAME --region $GCP_REGION

Create the PostgreSQL database, the Kafka cluster, and the Valkey cache in the cluster’s region and VPC network. They get private IP addresses only, which the GKE nodes reach without further firewall rules. You can create them in parallel; the Kafka cluster takes the longest, about 30 minutes.

Cloud SQL reaches your VPC network through private services access, which each network needs once. Check whether the network already has it:

Terminal window
gcloud services vpc-peerings list --network=$GCP_NETWORK

If the output lists the servicenetworking-googleapis-com peering, skip to the instance. Otherwise, reserve an IP range for Google services and connect it to the network:

Terminal window
gcloud compute addresses create google-managed-services-$GCP_NETWORK \
--global \
--purpose=VPC_PEERING \
--prefix-length=16 \
--network=projects/$GCP_PROJECT/global/networks/$GCP_NETWORK
gcloud services vpc-peerings connect \
--service=servicenetworking.googleapis.com \
--ranges=google-managed-services-$GCP_NETWORK \
--network=$GCP_NETWORK

Create a PostgreSQL 17 instance with a private IP address only, highly available across two zones of the region:

Terminal window
gcloud sql instances create $TB_DATABASE_NAME \
--database-version=POSTGRES_17 \
--region=$GCP_REGION --availability-type=regional \
--no-assign-ip --network=projects/$GCP_PROJECT/global/networks/$GCP_NETWORK \
--cpu=2 --memory=7680MB --edition=ENTERPRISE

For development, --availability-type=zonal runs a single instance at half the cost. Give production at least 2 vCPUs and 7.5 GB of memory. For every option, see Create instances.

Set the password of the postgres user. Replace secret with a strong password; you need it to connect TBMQ:

Terminal window
gcloud sql users set-password postgres \
--instance=$TB_DATABASE_NAME \
--password=secret

Create the database TBMQ connects to:

Terminal window
gcloud sql databases create thingsboard_mqtt_broker --instance=$TB_DATABASE_NAME

Create a Kafka cluster with 3 vCPUs and 3 GiB of memory, the smallest size the service offers. Its brokers get addresses in the region’s subnet of your network:

Terminal window
gcloud managed-kafka clusters create $TB_KAFKA_NAME \
--location=$GCP_REGION \
--cpu=3 \
--memory=3GiB \
--subnets=projects/$GCP_PROJECT/regions/$GCP_REGION/subnetworks/$GCP_NETWORK \
--async

--async returns at once; the cluster takes about 30 minutes to create. To size it for production, see Plan your Kafka cluster size.

The cluster accepts only authenticated TLS connections. TBMQ signs in with a service account key over SASL/PLAIN. Create a service account, allow it to use Kafka, and create a key for it. Keep the key file outside the cloned repository, so Git never picks it up:

Terminal window
gcloud iam service-accounts create tbmq-kafka-client --display-name="TBMQ Kafka client"
gcloud projects add-iam-policy-binding $GCP_PROJECT \
--member=serviceAccount:tbmq-kafka-client@$GCP_PROJECT.iam.gserviceaccount.com \
--role=roles/managedkafka.client --condition=None
gcloud iam service-accounts keys create ~/tbmq-kafka-client-key.json \
--iam-account=tbmq-kafka-client@$GCP_PROJECT.iam.gserviceaccount.com

TBMQ uses Valkey to store messages for DEVICE persistent clients and to cache MQTT client credentials. Without the cache, every new connection queries the database to validate its credentials, which can overload the database under high connection rates.

Memorystore reaches your network through Private Service Connect, which needs a service connection policy for the network and region. Check whether one exists:

Terminal window
gcloud network-connectivity service-connection-policies list --region=$GCP_REGION \
--filter="serviceClass=gcp-memorystore"

If none is listed, create it:

Terminal window
gcloud network-connectivity service-connection-policies create tbmq-valkey-policy \
--network=$GCP_NETWORK \
--region=$GCP_REGION \
--service-class=gcp-memorystore \
--subnets=https://www.googleapis.com/compute/v1/projects/$GCP_PROJECT/regions/$GCP_REGION/subnetworks/$GCP_NETWORK

Create a Valkey 8.0 instance with cluster mode enabled, one shard, and one replica in another zone:

Terminal window
gcloud memorystore instances create $TB_VALKEY_NAME \
--location=$GCP_REGION \
--psc-auto-connections=network=projects/$GCP_PROJECT/global/networks/$GCP_NETWORK,projectId=$GCP_PROJECT \
--mode=cluster \
--shard-count=1 \
--replica-count=1 \
--node-type=standard-small \
--engine-version=VALKEY_8_0 \
--async

The instance takes about 15 minutes to create. Recommendations:

  • Cluster mode: enabled (--mode=cluster) for production, which this guide uses. With --mode=cluster-disabled, a single primary node serves every key, with optional replicas; TBMQ supports both.
  • Shards: for production, 3 shards (--shard-count=3) with 1 replica each.
  • Node type: standard-small (6.5 GB) to start; see Instance and node specification.
  • Encryption in transit and authentication: both off by default, which this guide uses. TBMQ connects without TLS and without a password unless you configure it to.

Once the instance is RUNNABLE, get its private IP address:

Terminal window
gcloud sql instances describe $TB_DATABASE_NAME --format="value(ipAddresses[0].ipAddress)"

In tbmq-db-configmap.yml, replace YOUR_DB_IP_ADDRESS with it, YOUR_DB_NAME with thingsboard_mqtt_broker, and YOUR_DB_PASSWORD with the password you set:

SPRING_DATASOURCE_URL: "jdbc:postgresql://172.16.0.2:5432/thingsboard_mqtt_broker"
SPRING_DATASOURCE_USERNAME: "postgres"
SPRING_DATASOURCE_PASSWORD: "secret"

Once the cluster is ACTIVE, get its bootstrap address:

Terminal window
gcloud managed-kafka clusters describe $TB_KAFKA_NAME --location=$GCP_REGION --format="value(bootstrapAddress)"

In both tbmq.yml and tbmq-ie.yml, uncomment the block marked Uncomment the following lines to connect to Google Cloud Managed Service for Apache Kafka and replace PUT_YOUR_KAFKA_BOOTSTRAP_ADDRESS_HERE with the address:

- name: TB_KAFKA_SERVERS
value: "bootstrap-xxxxxxxxxx.xxxxxxxxx.us-central1.managedkafka.s.cloud.goog:9092"
- name: TB_KAFKA_DEFAULT_PRODUCER_CONSUMER_CONFIG
valueFrom:
secretKeyRef:
name: tbmq-kafka-credentials
key: kafka-config

TB_KAFKA_DEFAULT_PRODUCER_CONSUMER_CONFIG carries the SASL settings and the service account key, from the tbmq-kafka-credentials Secret that you create after installing the database schema.

Once the instance is ACTIVE, list its endpoints:

Terminal window
gcloud memorystore instances describe $TB_VALKEY_NAME --location=$GCP_REGION \
--flatten="endpoints[].connections[]" \
--format="table(endpoints.connections.pscAutoConnection.connectionType:label=TYPE,endpoints.connections.pscAutoConnection.ipAddress:label=ADDRESS)"
TYPE ADDRESS
CONNECTION_TYPE_DISCOVERY 10.128.0.36
10.128.0.35

TBMQ connects to the CONNECTION_TYPE_DISCOVERY address; the other one is used by Memorystore internally. In tbmq-cache-configmap.yml, set it with port 6379 in REDIS_NODES, and keep REDIS_CONNECTION_TYPE: "cluster":

REDIS_CONNECTION_TYPE: "cluster"
REDIS_NODES: "10.128.0.36:6379"

With cluster mode disabled, the command lists a CONNECTION_TYPE_PRIMARY address instead. Set it, without the port, in REDIS_HOST, and set the connection type to standalone:

REDIS_CONNECTION_TYPE: "standalone"
REDIS_HOST: "10.128.0.36"

Run the installation script. It creates the thingsboard-mqtt-broker namespace, sets it as the namespace of your current kubectl context, and creates the TBMQ database schema:

Terminal window
./k8s-install-tbmq.sh

When it finishes, the output includes:

INFO o.t.m.b.i.ThingsboardMqttBrokerInstallService - Installation finished successfully!

Skip this section if you run Kafka in the cluster.

Create the tbmq-kafka-credentials Secret from the Kafka service account key. It sets SASL over TLS, the PLAIN mechanism, the service account as the username, and the Base64-encoded key as the password. The same command replaces the key when you rotate it:

Terminal window
kubectl create secret generic tbmq-kafka-credentials -n thingsboard-mqtt-broker \
--from-literal=kafka-config="security.protocol:SASL_SSL;sasl.mechanism:PLAIN;sasl.jaas.config:org.apache.kafka.common.security.plain.PlainLoginModule required username=\"tbmq-kafka-client@$GCP_PROJECT.iam.gserviceaccount.com\" password=\"$(base64 -w0 ~/tbmq-kafka-client-key.json)\"\\;" \
-o yaml --dry-run=client | kubectl apply -f -

base64 -w0 is the Linux syntax; on macOS, use base64 -i ~/tbmq-kafka-client-key.json. After you replace the key of a running deployment, restart the pods to pick it up:

Terminal window
kubectl rollout restart statefulset/tbmq statefulset/tbmq-integration-executor -n thingsboard-mqtt-broker

Managed Kafka keeps topic data in tiered storage, which rejects the segment.bytes setting TBMQ applies to every topic it creates. Apply the topic settings for Managed Kafka, which leave segment.bytes at the service’s default and replicate each topic to three brokers:

Terminal window
kubectl apply -f kafka/managed/tbmq-kafka-topics-configmap.yml

tbmq.yml and tbmq-ie.yml read the tbmq-kafka-topics-config ConfigMap it creates, if it exists. Without it, the broker nodes fail to start with PolicyViolationException: segment.bytes is an immutable property if remote storage is enabled.

Skip this section if you use Managed Kafka. To run Kafka in GKE instead, skip Managed Service for Apache Kafka and Configure the Kafka connection, deploy Kafka with one of these options, and in both tbmq.yml and tbmq-ie.yml uncomment the matching TB_KAFKA_SERVERS block instead of the Managed Kafka one.

Three pods in KRaft dual-role mode: each node is both a controller and a broker. See the full deployment guide.

Terminal window
kubectl apply -f kafka/tbmq-kafka.yml

Uncomment the block marked Uncomment the following lines to connect to Apache Kafka.

The Strimzi Cluster Operator manages upgrades and scaling. See the full deployment guide.

Terminal window
helm install tbmq-kafka -f kafka/operator/values-strimzi-kafka-operator.yaml oci://quay.io/strimzi-helm/strimzi-kafka-operator --version 0.47.0
kubectl apply -f kafka/operator/kafka-cluster.yaml
kubectl wait kafka/tbmq --for=condition=Ready --timeout=300s

Uncomment the block marked Uncomment the following lines to connect to Strimzi.

Deploy TBMQ:

Terminal window
./k8s-deploy-tbmq.sh

Wait until the broker nodes are ready:

Terminal window
kubectl rollout status statefulset/tbmq -n thingsboard-mqtt-broker --timeout=600s
kubectl get pods -n thingsboard-mqtt-broker
NAME READY STATUS RESTARTS AGE
tbmq-0 1/1 Running 0 2m
tbmq-1 1/1 Running 0 2m
tbmq-integration-executor-0 1/1 Running 0 2m
tbmq-integration-executor-1 1/1 Running 0 2m

The receipts directory holds one manifest per load balancer. Apply one HTTP manifest and the MQTT manifest:

Manifest Load balancer Ports
http-load-balancer.yml Application Load Balancer 80 (HTTP)
https-load-balancer.yml Application Load Balancer 443 (HTTPS); 80 redirects to HTTPS
mqtt-load-balancer.yml Passthrough Network Load Balancer 1883 (MQTT), 8084 (MQTT over WebSockets); 8883 and 8085 passed through to TBMQ
Terminal window
kubectl apply -f receipts/http-load-balancer.yml

The Application Load Balancer serves HTTPS with a Google-managed certificate for your domain. Reserve a global static IP address, which the manifest names tbmq-http-lb-address, and print it:

Terminal window
gcloud compute addresses create tbmq-http-lb-address --global
gcloud compute addresses describe tbmq-http-lb-address --global --format="value(address)"

Point your domain at the address with a DNS A record. In receipts/https-load-balancer.yml, replace PUT_YOUR_DOMAIN_HERE with the domain, then apply the manifest:

Terminal window
kubectl apply -f receipts/https-load-balancer.yml

The certificate is issued once the domain resolves to the address, which can take up to 60 minutes. Its status turns Active:

Terminal window
kubectl describe managedcertificate managed-cert -n thingsboard-mqtt-broker
Terminal window
kubectl apply -f receipts/mqtt-load-balancer.yml

The Network Load Balancer passes TCP through to TBMQ unchanged, so it can’t terminate TLS. It serves plain MQTT on 1883 and 8084, and forwards 8883 and 8085 to TBMQ, which serves them once you enable MQTT over TLS.

TBMQ terminates TLS itself on 8883 (MQTTS) and 8085 (MQTT over secure WebSockets). This also supports X.509 certificate authentication.

Prepare the server certificate chain and its private key in PEM format; see MQTT over SSL. Create a ConfigMap from them. The same command replaces the files when you renew the certificate:

Terminal window
kubectl create configmap tbmq-mqtts-config -n thingsboard-mqtt-broker \
--from-file=server.pem=YOUR_PEM_FILENAME \
--from-file=mqttserver_key.pem=YOUR_PEM_KEY_FILENAME \
-o yaml --dry-run=client | kubectl apply -f -

Where:

  • YOUR_PEM_FILENAME: the server certificate chain file.
  • YOUR_PEM_KEY_FILENAME: the server certificate’s private key file.

In tbmq.yml, uncomment the three blocks marked Uncomment the following lines to enable two-way MQTTS. They mount the certificate and enable MQTTS on 8883 and MQTT over secure WebSockets on 8085. Apply the updated tbmq.yml, which restarts the broker nodes one at a time:

Terminal window
kubectl apply -f tbmq.yml

Get the address of the Application Load Balancer:

Terminal window
kubectl get ingress -n thingsboard-mqtt-broker
NAME CLASS HOSTS ADDRESS PORTS AGE
tbmq-http-loadbalancer <none> * 136.82.226.40 80 7m

The load balancer takes a few minutes to provision, and its address answers with 404 or 502 errors until the health checks pass. Then open http://{ADDRESS} in your browser, or your domain over HTTPS if you deployed the HTTPS load balancer, and sign in as System Administrator:

Username
sysadmin@thingsboard.org
Password
sysadmin

Change the password after the first sign-in.

Get the address of the Network Load Balancer:

Terminal window
kubectl get svc tbmq-mqtt-loadbalancer -n thingsboard-mqtt-broker
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
tbmq-mqtt-loadbalancer LoadBalancer 34.118.227.221 104.198.132.85 1883:32086/TCP,8084:32211/TCP,8883:30408/TCP,8085:32092/TCP 3m

MQTT clients connect to the EXTERNAL-IP on the ports listed in Configure load balancers.

To check the broker end to end, publish and subscribe with the Mosquitto clients. A new installation has one MQTT credential, TBMQ WebSockets MQTT Credentials: username tbmq_websockets_username and no password. In one terminal, subscribe:

Terminal window
mosquitto_sub -h {EXTERNAL-IP} -p 1883 -u tbmq_websockets_username -t 'tbmq/demo/#' -v -q 1

In another, publish:

Terminal window
mosquitto_pub -h {EXTERNAL-IP} -p 1883 -u tbmq_websockets_username -t 'tbmq/demo/hello' -m 'hello from gke' -q 1

The subscriber prints tbmq/demo/hello hello from gke. A client that connects without a username is refused as not authorized, because MQTT Basic authentication is enabled by default. To create your own credentials, see MQTT client credentials.

View the logs of a broker node:

Terminal window
kubectl logs -f tbmq-0 -n thingsboard-mqtt-broker

Check the state of the StatefulSets:

Terminal window
kubectl get statefulsets -n thingsboard-mqtt-broker

If a broker node logs connection errors to PostgreSQL, Kafka, or Valkey, check the address you set, and that the service is in the same region and VPC network as the GKE cluster. Kafka authentication errors mean the tbmq-kafka-credentials Secret or the service account’s roles/managedkafka.client role is wrong.

If the Ingress ADDRESS or the Service EXTERNAL-IP stays empty, its events give the reason:

Terminal window
kubectl describe ingress -n thingsboard-mqtt-broker
kubectl describe svc tbmq-mqtt-loadbalancer -n thingsboard-mqtt-broker

See the kubectl Cheat Sheet for more details.

  1. Check the version-specific notes below for any preparation your target version requires.
  2. Back up your database (optional but recommended).
  3. Run the upgrade commands.

For full version history and supported upgrade paths, see the upgrade instructions page. If the documentation does not cover your specific upgrade path, contact us for guidance.

What each upgrade needs before you run the upgrade — select a version for its full notes:

Upgrade to Before running the upgrade
2.4.2 Nothing. Check SCRAM-only authentication and Kafka integrations
2.4.1 Nothing. If you set MQTT_TOPIC_MAX_SEGMENTS_COUNT, raise it by 1
2.4.0 Nothing. If you scrape metrics, update queries for the renamed Prometheus metrics
2.3.0 Delete the TBMQ pods first. Plan the third-party component migration
2.2.0 Delete the TBMQ pods first. Check the authentication settings in database-setup.yml

Backing up your PostgreSQL database before upgrading is highly recommended but optional. For guidance, follow the Cloud SQL backup and recovery documentation.

This is a standard upgrade from v2.4.1. No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.

Then proceed with the upgrade.

This is a standard upgrade from v2.4.0.

No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.

Then proceed with the upgrade.

This is a standard upgrade from v2.3.0.

No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.

Then proceed with the upgrade.

This release migrates all third-party components from Bitnami images to official open-source alternatives.

Review the third-party component updates for full details.

Then proceed with the upgrade.

This release migrates MQTT authentication from YAML/env configuration into the database.

The upgrade script reads from database-setup.yml. Variables from tbmq.yml are not applied during the upgrade — only the values in database-setup.yml are used. Ensure this file reflects your active configuration.

Supported variables in database-setup.yml

  • SECURITY_MQTT_BASIC_ENABLED (true|false)
  • SECURITY_MQTT_SSL_ENABLED (true|false)
  • SECURITY_MQTT_SSL_SKIP_VALIDITY_CHECK_FOR_CLIENT_CERT (true|false) — usually false

Once the file is verified, proceed with the upgrade.

The upgrade merges the new release branch into your clone and keeps your settings. Git merges only committed changes, so commit your settings first:

Terminal window
git add -A .
git commit -m "TBMQ configuration"

If Git asks who you are, set git config user.name and git config user.email, then commit again.

Merge the release branch:

Terminal window
git pull --no-rebase --no-edit origin release-2.4.2

If the merge reports conflicts, list the conflicting files:

Terminal window
git diff --name-only --diff-filter=U

If you didn’t change any of them, for example the pom.xml files of the TBMQ source code, take the release’s version of every conflict:

Terminal window
git merge --abort
git pull --no-rebase --no-edit -X theirs origin release-2.4.2

-X theirs keeps your changes wherever they don’t conflict with the release. If a file you changed conflicts, resolve it by hand instead and run git commit.

Check that your settings are the only differences from the release branch:

Terminal window
git diff --stat origin/release-2.4.2 -- .

After pulling, run the database upgrade and then apply the updated manifests to roll out the new version:

Terminal window
./k8s-upgrade-tbmq.sh
./k8s-deploy-tbmq.sh
  1. Delete the TBMQ nodes.

    Terminal window
    ./k8s-delete-tbmq.sh
  2. Delete Kafka, if it runs in the cluster with Strimzi. Delete the Kafka cluster first, then the operator:

    Terminal window
    kubectl delete -f kafka/operator/kafka-cluster.yaml
    helm uninstall tbmq-kafka
  3. Delete the HTTPS load balancer, if you deployed it. k8s-delete-all.sh doesn’t delete its ManagedCertificate, and GKE deletes the Google-managed SSL certificate only when that object is deleted:

    Terminal window
    kubectl delete -f receipts/https-load-balancer.yml
  4. Delete the remaining resources in the thingsboard-mqtt-broker namespace: the Services, including the MQTT load balancer, the StatefulSets, the ConfigMaps, the Ingress, and the persistent volume claims:

    Terminal window
    ./k8s-delete-all.sh
  5. Wait for the load balancers to go. GKE deletes them once the Ingress and the Service are gone. Wait until this command lists nothing:

    Terminal window
    gcloud compute forwarding-rules list --filter="description~thingsboard-mqtt-broker" --format="table(name,IPAddress)"
  6. Delete the GKE cluster.

    Terminal window
    gcloud container clusters delete $TB_CLUSTER_NAME --region=$GCP_REGION
  7. Delete the managed services.

    Terminal window
    gcloud sql instances delete $TB_DATABASE_NAME
    gcloud managed-kafka clusters delete $TB_KAFKA_NAME --location=$GCP_REGION
    gcloud memorystore instances delete $TB_VALKEY_NAME --location=$GCP_REGION
  8. Delete the Kafka service account and its role binding. Deleting the service account also deletes its key; delete the local key file too:

    Terminal window
    gcloud projects remove-iam-policy-binding $GCP_PROJECT \
    --member=serviceAccount:tbmq-kafka-client@$GCP_PROJECT.iam.gserviceaccount.com \
    --role=roles/managedkafka.client --condition=None
    gcloud iam service-accounts delete tbmq-kafka-client@$GCP_PROJECT.iam.gserviceaccount.com
    rm ~/tbmq-kafka-client-key.json
  9. Delete the network resources you created for this guide. Skip any that existed before or that other services in the project still use: the service connection policy, the HTTPS load balancer’s static IP address, and the private services access peering and its IP range.

    Terminal window
    gcloud network-connectivity service-connection-policies delete tbmq-valkey-policy --region=$GCP_REGION
    gcloud compute addresses delete tbmq-http-lb-address --global
    gcloud services vpc-peerings delete --service=servicenetworking.googleapis.com --network=$GCP_NETWORK
    gcloud compute addresses delete google-managed-services-$GCP_NETWORK --global

Connect your first client

Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.

Secure the broker

Choose the authentication provider that fits your clients. See Security overview.

Watch the broker

Track sessions, throughput, and resource usage as traffic grows. See Monitoring.