Skip to content
Stand with Ukraine flag

Helm · GCP GKE

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

The chart deploys only TBMQ: two broker nodes and two Integration Executors. PostgreSQL, Kafka, and a Redis-compatible cache run separately. This guide deploys them in the cluster with CrunchyData PGO, Strimzi, and Valkey; you can use Cloud SQL for PostgreSQL, Google Cloud Managed Service for Apache Kafka, and Memorystore for Valkey instead. Web traffic goes through a Google Cloud Application Load Balancer and MQTT traffic through a passthrough Network Load Balancer.

GKE cluster · TBMQ Helm chart

  • TBMQ × 2
  • Integration Executor × 2

Dependencies

  • PostgreSQL (PGO or Cloud SQL)
  • Kafka (Strimzi or Managed Kafka)
  • Valkey (or Memorystore)

Load balancer ports

  • 80 HTTP · Application LB TBMQ UI and REST API
  • 443 HTTPS · Application LB TBMQ UI and REST API, once you enable HTTPS access
  • 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 configure mutual TLS
  • 8085 MQTT over secure WebSockets · Network LB MQTT clients that connect over secure WebSockets, once you configure mutual TLS

Install the following tools:

Your Google Cloud account needs permission to create GKE clusters and load balancers in the project, and the managed services if you use them.

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

Terminal window
gcloud init

Enable the GKE API:

Terminal window
gcloud services enable container.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.
  • GCP_NETWORK: the VPC network, default for the network every new project has. Its subnet in each region is also named default; the managed services commands name the subnet with $GCP_NETWORK too, so if you use another network, give the subnet the same name or edit those commands.
  • TB_CLUSTER_NAME: the name of the GKE cluster.
  • TB_DATABASE_NAME, TB_KAFKA_NAME, TB_VALKEY_NAME: the names of the Cloud SQL instance, the Kafka cluster, and the Valkey instance. You need them only if you use Google Cloud managed services.

Create a regional cluster with one e2-standard-4 node in each of the three zones. TBMQ and the dependencies this guide deploys share these nodes. 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
Terminal window
helm repo add tbmq-helm-chart https://helm.thingsboard.io/tbmq
helm repo update

Create a namespace for TBMQ and its dependencies:

Terminal window
kubectl create namespace tbmq

Every command in this guide passes -n tbmq.

The chart doesn’t include PostgreSQL, Kafka, or a Redis-compatible cache. Any instances that TBMQ can reach work. This section deploys a small set in the cluster; size it for your load before production. To use Google Cloud managed services instead, skip to Use Google Cloud managed services.

Install the CrunchyData PGO operator and wait for it:

Terminal window
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo \
--version 6.0.1 -n tbmq
kubectl wait --for=condition=Ready pod -l postgres-operator.crunchydata.com/control-plane=pgo \
-n tbmq --timeout=180s

Create a PostgreSQL 17 cluster with the thingsboard_mqtt_broker database:

Terminal window
cat <<'EOF' | kubectl apply -n tbmq -f -
apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
name: tbmq-db
spec:
postgresVersion: 17
instances:
- name: instance1
replicas: 1
dataVolumeClaimSpec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
users:
- name: postgres
databases:
- thingsboard_mqtt_broker
backups:
pgbackrest:
repos:
- name: repo1
volume:
volumeClaimSpec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
EOF

Wait for the database pod. PGO creates it a few seconds after the manifest is applied, so the first command waits for the pod to exist:

Terminal window
until kubectl get pod -n tbmq -l postgres-operator.crunchydata.com/data=postgres 2>/dev/null | grep -q tbmq-db; do sleep 3; done
kubectl wait --for=condition=Ready pod -l postgres-operator.crunchydata.com/data=postgres \
-n tbmq --timeout=300s

PGO serves the database at tbmq-db-primary:5432 and stores the generated password in the Secret tbmq-db-pguser-postgres, key password.

Install the Strimzi operator and wait for it:

Terminal window
helm repo add strimzi https://strimzi.io/charts/
helm repo update
helm install strimzi strimzi/strimzi-kafka-operator --version 0.50.0 -n tbmq
kubectl wait --for=condition=Ready pod -l name=strimzi-cluster-operator -n tbmq --timeout=180s

Create a three-node Kafka 4.0 cluster in KRaft mode:

Terminal window
cat <<'EOF' | kubectl apply -n tbmq -f -
apiVersion: kafka.strimzi.io/v1
kind: KafkaNodePool
metadata:
name: combined
labels:
strimzi.io/cluster: tbmq-kafka
spec:
replicas: 3
roles:
- controller
- broker
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 10Gi
deleteClaim: false
resources:
requests:
memory: "2Gi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "1"
---
apiVersion: kafka.strimzi.io/v1
kind: Kafka
metadata:
name: tbmq-kafka
annotations:
strimzi.io/node-pools: enabled
strimzi.io/kraft: enabled
spec:
kafka:
version: 4.0.0
metadataVersion: "4.0"
listeners:
- name: plain
port: 9092
type: internal
tls: false
config:
auto.create.topics.enable: false
default.replication.factor: 2
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
entityOperator:
topicOperator: {}
userOperator: {}
EOF

Wait for the cluster; this takes a few minutes:

Terminal window
kubectl wait kafka/tbmq-kafka --for=condition=Ready -n tbmq --timeout=600s

Kafka is reachable at tbmq-kafka-kafka-bootstrap:9092.

Install a standalone Valkey without a password and wait for it:

Terminal window
helm repo add valkey https://valkey.io/valkey-helm/
helm repo update
helm install valkey valkey/valkey --version 0.9.3 -n tbmq
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=valkey -n tbmq --timeout=180s

Valkey is reachable at valkey:6379.

To use Cloud SQL for PostgreSQL, Managed Service for Apache Kafka, and Memorystore for Valkey instead of the in-cluster deployments, create them in the cluster’s region and VPC network, as described in Create the Google Cloud managed services of the GCP cluster setup guide. Enable the APIs they need first, as listed in its Configure GCP tools section. The commands there read the environment variables you defined above.

Once the services are ready, get their addresses: the Cloud SQL private IP address, the Kafka bootstrap address, and the Memorystore endpoints:

Terminal window
gcloud sql instances describe $TB_DATABASE_NAME --format="value(ipAddresses[0].ipAddress)"
gcloud managed-kafka clusters describe $TB_KAFKA_NAME --location=$GCP_REGION --format="value(bootstrapAddress)"
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)"

TBMQ connects to the Memorystore CONNECTION_TYPE_DISCOVERY address.

Create the PostgreSQL password Secret in the tbmq namespace:

Terminal window
kubectl create secret generic tbmq-db-secret -n tbmq --from-literal=password='YOUR_DB_PASSWORD'

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 tbmq \
--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/my-tbmq-cluster-tbmq-node statefulset/my-tbmq-cluster-tbmq-ie -n tbmq

Then set the addresses in Connect to dependencies instead of the in-cluster values:

postgresql:
host: "172.16.0.2"
port: 5432
database: "thingsboard_mqtt_broker"
username: "postgres"
existingSecret: "tbmq-db-secret"
existingSecretPasswordKey: "password"
kafka:
bootstrapServers: "bootstrap-xxxxxxxxxx.xxxxxxxxx.us-central1.managedkafka.s.cloud.goog:9092"
existingSecret: "tbmq-kafka-credentials"
redis:
connectionType: "cluster"
nodes: "10.128.0.36:6379"
usePassword: false

kafka.existingSecret needs chart version 2.3.2 or later. With Memorystore cluster mode disabled, set connectionType: "standalone" and host to the CONNECTION_TYPE_PRIMARY address instead of nodes.

Managed Kafka keeps topic data in tiered storage, which rejects the segment.bytes setting TBMQ applies to every topic it creates: without the following settings, the broker nodes fail to start with PolicyViolationException: segment.bytes is an immutable property if remote storage is enabled. In Connect to dependencies, also set the topic settings for Managed Kafka in customEnv of the tbmq and tbmq-ie sections. They keep TBMQ’s defaults without segment.bytes, and replicate each topic to three brokers:

tbmq:
customEnv:
TB_KAFKA_MSG_ALL_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:2147483648;partitions:16;replication.factor:3"
TB_KAFKA_APP_PERSISTED_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;replication.factor:3"
TB_KAFKA_APP_PERSISTED_MSG_SHARED_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;replication.factor:3"
TB_KAFKA_DEVICE_PERSISTED_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:12;replication.factor:3"
TB_KAFKA_RETAINED_MSG_TOPIC_PROPERTIES: "partitions:1;replication.factor:3"
TB_KAFKA_CLIENT_SESSION_TOPIC_PROPERTIES: "partitions:1;replication.factor:3"
TB_KAFKA_CLIENT_SUBSCRIPTIONS_TOPIC_PROPERTIES: "partitions:1;replication.factor:3"
TB_KAFKA_CLIENT_SESSION_EVENT_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:24;replication.factor:3"
TB_KAFKA_CLIENT_SESSION_EVENT_RESPONSE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_DISCONNECT_CLIENT_COMMAND_RESPONSE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_BASIC_DOWNLINK_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:12;replication.factor:3"
TB_KAFKA_PERSISTED_DOWNLINK_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:12;replication.factor:3"
TB_KAFKA_APPLICATION_REMOVED_EVENT_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_HISTORICAL_DATA_TOTAL_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_INTERNODE_NOTIFICATIONS_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_BLOCKED_CLIENT_TOPIC_PROPERTIES: "partitions:1;replication.factor:3"
TB_KAFKA_IE_DOWNLINK_HTTP_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_DOWNLINK_KAFKA_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_DOWNLINK_MQTT_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_UPLINK_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_UPLINK_NOTIF_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_IE_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;replication.factor:3"
TB_KAFKA_IE_EVENT_MSG_TOPIC_PROPERTIES: "retention.ms:86400000;retention.bytes:104857600;partitions:1;replication.factor:3"
tbmq-ie:
customEnv:
TB_KAFKA_IE_DOWNLINK_HTTP_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_DOWNLINK_KAFKA_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_DOWNLINK_MQTT_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_UPLINK_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3"
TB_KAFKA_IE_UPLINK_NOTIF_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:1;replication.factor:3"
TB_KAFKA_IE_MSG_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;replication.factor:3"
TB_KAFKA_IE_EVENT_MSG_TOPIC_PROPERTIES: "retention.ms:86400000;retention.bytes:104857600;partitions:1;replication.factor:3"

For all postgresql, kafka, and redis keys, see the connection settings in the chart documentation.

Export the chart’s default values to a values.yaml file:

Terminal window
helm show values tbmq-helm-chart/tbmq-cluster > values.yaml

The file pins the chart defaults, including the TBMQ image tags. Keep it: you edit and reuse it on every upgrade.

In values.yaml, find the postgresql, kafka, and redis sections and set these keys to point at the services from the previous section:

postgresql:
host: "tbmq-db-primary"
port: 5432
database: "thingsboard_mqtt_broker"
username: "postgres"
existingSecret: "tbmq-db-pguser-postgres"
existingSecretPasswordKey: "password"
kafka:
bootstrapServers: "tbmq-kafka-kafka-bootstrap:9092"
redis:
connectionType: "standalone"
host: "valkey"
port: 6379
usePassword: false

redis.connectionType defaults to cluster, so change it for a single Valkey node.

If you use Google Cloud managed services, set the postgresql, kafka, and redis values from Use Google Cloud managed services instead, and add the Kafka topic settings from the same section to customEnv of the tbmq and tbmq-ie sections. Without the topic settings, the broker nodes don’t start.

Set the load balancer type to gcp:

loadbalancer:
type: "gcp"

The chart then creates two internet-facing load balancers through GKE:

Load balancer Kubernetes resource Ports
Application Load Balancer Ingress my-tbmq-cluster-http-lb 80 (HTTP); 443 (HTTPS) with HTTPS enabled
Passthrough Network Load Balancer Service my-tbmq-cluster-mqtt-lb 1883 (MQTT), 8084 (MQTT over WebSockets), 8883 (MQTTS), 8085 (MQTT over secure WebSockets)

The Network Load Balancer passes TCP through to TBMQ unchanged, so it can’t terminate TLS. MQTTS and secure WebSockets work once TBMQ terminates TLS itself, with mutual TLS.

The Application Load Balancer serves HTTPS with a Google-managed certificate for your domain. Reserve a global static IP 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. Then enable HTTPS in values.yaml:

loadbalancer:
type: "gcp"
http:
enabled: true
ssl:
enabled: true
certificateRef: "tbmq-managed-cert"
domains:
- "{your-domain}"
staticIP: "tbmq-http-lb-address"

The chart creates a ManagedCertificate named after certificateRef for the listed domains, assigns the static IP address to the load balancer, and redirects HTTP on 80 to HTTPS. The certificate is issued once the domain resolves to the address, which can take up to 60 minutes. After installing, its status turns Active:

Terminal window
kubectl describe managedcertificate tbmq-managed-cert -n tbmq

With mutual TLS, the Network Load Balancer forwards ports 8883 and 8085 unchanged, and TBMQ terminates TLS itself. This also supports X.509 certificate authentication.

Create a Secret with the server certificate chain and its private key, in PEM format:

Terminal window
kubectl create secret generic tbmq-mqtts -n tbmq \
--from-file=server.pem=server-chain.pem \
--from-file=mqttserver_key.pem=server.key

Enable mutual TLS in values.yaml:

loadbalancer:
type: "gcp"
mqtt:
enabled: true
mutualTls:
enabled: true
existingSecretName: "tbmq-mqtts"

This enables MQTTS on 8883. To also serve MQTT over secure WebSockets on 8085 with the same certificate, add to customEnv of the tbmq section:

tbmq:
customEnv:
LISTENER_WSS_ENABLED: "true"
LISTENER_WSS_PEM_CERT: "/ssl-config/server.pem"
LISTENER_WSS_PEM_KEY: "/ssl-config/mqttserver_key.pem"

For a password-protected key and the other options, see mutual TLS in the chart documentation.

From the directory with your values.yaml, install the chart:

Terminal window
helm install my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq \
-f values.yaml \
--set installation.installDbSchema=true

my-tbmq-cluster is the Helm release name. It prefixes every resource the chart creates, and later helm commands refer to it.

Helm runs a one-time install pod that creates the database schema and returns when the pod succeeds, usually within a minute:

NAME: my-tbmq-cluster
NAMESPACE: tbmq
STATUS: deployed
REVISION: 1
...

The broker pods start after the schema exists. Wait until they are ready:

Terminal window
kubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600s

Get the address of the Application Load Balancer:

Terminal window
kubectl get ingress my-tbmq-cluster-http-lb -n tbmq
NAME CLASS HOSTS ADDRESS PORTS AGE
my-tbmq-cluster-http-lb <none> * 34.144.233.246 80 5m

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 enabled it, 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 my-tbmq-cluster-mqtt-lb -n tbmq
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-tbmq-cluster-mqtt-lb LoadBalancer 34.118.239.54 104.198.132.85 1883:32017/TCP,8084:32121/TCP,8883:32276/TCP,8085:31926/TCP 5m

MQTT clients connect to EXTERNAL-IP on port 1883, and MQTT over WebSockets on port 8084.

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.

List the TBMQ pods:

Terminal window
kubectl get pods -n tbmq -l 'app in (my-tbmq-cluster-tbmq-node,my-tbmq-cluster-tbmq-ie,install-job)'

View the logs of a broker node:

Terminal window
kubectl logs -f my-tbmq-cluster-tbmq-node-0 -n tbmq

If helm install fails with failed post-install, the schema install did not succeed. Read the install pod’s logs:

Terminal window
kubectl logs my-tbmq-cluster-install-pod -n tbmq

If applying the Kafka manifest fails with no matches for kind "KafkaNodePool" in version "kafka.strimzi.io/v1", the cluster has the resource definitions of an older Strimzi release, which helm install doesn’t upgrade. Replace them with the definitions of Strimzi 0.50.0, then apply the manifest again:

Terminal window
kubectl apply --server-side --force-conflicts \
-f https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.50.0/strimzi-crds-0.50.0.yaml

Broker pods that stay in Init:0/1 are waiting for the schema. For the common causes and fixes, see Troubleshooting the install in the chart documentation.

With Managed Kafka, SaslAuthenticationException in the broker logs means the tbmq-kafka-credentials Secret or the service account’s roles/managedkafka.client role is wrong; Invalid JWT Signature means the Secret holds a key that was deleted. After you fix the Secret, restart the pods:

Terminal window
kubectl rollout restart statefulset/my-tbmq-cluster-tbmq-node statefulset/my-tbmq-cluster-tbmq-ie -n tbmq

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

Terminal window
kubectl describe ingress my-tbmq-cluster-http-lb -n tbmq
kubectl describe svc my-tbmq-cluster-mqtt-lb -n tbmq
  • The Ingress has no events at all: GKE ignores it. Charts before 2.3.2 select the controller with ingressClassName: gce, which matches no IngressClass on GKE. Upgrade the release to chart 2.3.2 or later.
  • Error syncing to GCP for a networkEndpointGroups resource named ...-kube-system-default-http-backend-...: GKE deleted the default backend’s network endpoint group along with the cluster’s previous Ingress, for example after you uninstalled and reinstalled the release. GKE recreates it, and the address appears within about 10 minutes.

Back up your PostgreSQL database before upgrading. Then review the upgrade instructions for the notes on every version between yours and the target.

  1. Update the chart repository.

    Terminal window
    helm repo update
  2. Compare versions.

    The APP VERSION column is the TBMQ version. Compare your release with the latest chart:

    Terminal window
    helm list -n tbmq
    helm search repo tbmq-helm-chart/tbmq-cluster
  3. Update values.yaml.

    Export the new defaults and compare them with your file:

    Terminal window
    helm show values tbmq-helm-chart/tbmq-cluster > values-new.yaml
    diff values.yaml values-new.yaml

    Carry the changes you need into values.yaml. Always update the image tags, or the release keeps running the old TBMQ version:

    tbmq:
    image:
    tag: 2.4.2
    tbmq-ie:
    image:
    tag: 2.4.2
  4. Run the upgrade.

    Terminal window
    helm upgrade my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq \
    -f values.yaml \
    --set upgrade.upgradeDbSchema=true

    A pre-upgrade job migrates the database, then Kubernetes replaces the TBMQ pods one at a time, each after the previous one is ready. Wait for it to finish:

    Terminal window
    kubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600s

If the APP VERSION doesn’t change, there is nothing to migrate: run the same helm upgrade without --set upgrade.upgradeDbSchema=true. With it, the migration fails with database already upgraded to current version and the release is marked failed; running the upgrade again without the flag fixes it.

Chart 2.0.0 (TBMQ 2.3.0) removed the PostgreSQL, Kafka, and Redis subcharts that chart 1.x bundled. To upgrade a release from chart 1.x, follow Upgrading from chart version 1.x to 2.0.0 in the chart documentation.

Terminal window
helm uninstall my-tbmq-cluster -n tbmq

This removes the TBMQ resources of the release, and GKE deletes the two load balancers. It keeps the broker’s data volumes; delete them with:

Terminal window
kubectl delete pvc -n tbmq -l app=my-tbmq-cluster-tbmq-node

PostgreSQL, Kafka, and Valkey keep running, and so do the Secrets you created.

To remove the in-cluster dependencies too, delete the database and Kafka clusters while their operators still run, then the operators, Valkey, and the namespace:

Terminal window
kubectl delete postgrescluster tbmq-db -n tbmq
kubectl delete kafka tbmq-kafka -n tbmq
kubectl delete kafkanodepool combined -n tbmq
helm uninstall valkey strimzi pgo -n tbmq
kubectl delete namespace tbmq

Deleting the namespace first leaves it stuck in Terminating: the operators are removed before they can clean up their clusters. Deleting the namespace also deletes the remaining volumes and their disks.

If you use Google Cloud managed services, delete only the namespace:

Terminal window
kubectl delete namespace tbmq

The managed services aren’t affected; Delete the GKE cluster covers them.

  1. Uninstall TBMQ and its dependencies, as in the previous section.

  2. Wait for the load balancers to go. GKE deletes them once the Ingress and the Service are gone. A load balancer that still exists when the cluster is deleted is left behind. Wait until this command lists nothing:

    Terminal window
    gcloud compute forwarding-rules list --filter="description~tbmq/my-tbmq-cluster" --format="table(name,IPAddress)"
  3. Delete the GKE cluster.

    Terminal window
    gcloud container clusters delete $TB_CLUSTER_NAME --region=$GCP_REGION

    The deletion takes about 10 minutes.

  4. Delete the HTTPS static IP address, if you reserved one:

    Terminal window
    gcloud compute addresses delete tbmq-http-lb-address --global
  5. Delete the Google Cloud managed services, if you use them: the instances, the Kafka service account and its key, and the network resources you created for them. Follow the Delete the managed services, Delete the Kafka service account and its role binding, and Delete the network resources you created for this guide steps of Cluster deletion in the GCP cluster setup guide.

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.

Tune the configuration

Change broker settings through environment variables in tbmq.customEnv of your values.yaml. See How to change configuration.

Watch the broker

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