Connect your first client
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
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
Dependencies
Load balancer ports
Install the following tools:
gcloud)gke-gcloud-auth-plugin), which kubectl uses to sign in to GKEYour Google Cloud account needs permission to create GKE clusters and load balancers in the project, and the managed services if you use them.
You need a TBMQ PE license key. To buy one, open the Pricing page, choose a pay-as-you-go subscription or a perpetual license, and use the calculator to size your deployment: session and throughput limits, production and development instances, and any add-ons.
You apply the key in Configure license and broker images.
Create a Google Cloud project (recommended) or choose an existing one, then sign in and select it:
gcloud initEnable the GKE API:
gcloud services enable container.googleapis.comThe 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:
export GCP_PROJECT=$(gcloud config get-value project)export GCP_REGION=us-central1export GCP_ZONE1=us-central1-aexport GCP_ZONE2=us-central1-bexport GCP_ZONE3=us-central1-cexport GCP_NETWORK=defaultexport TB_CLUSTER_NAME=tbmq-clusterexport TB_DATABASE_NAME=tbmq-dbexport TB_KAFKA_NAME=tbmq-kafkaexport TB_VALKEY_NAME=tbmq-valkeyecho "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.
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-4This 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:
gcloud container clusters get-credentials $TB_CLUSTER_NAME --region $GCP_REGIONhelm repo add tbmq-helm-chart https://helm.thingsboard.io/tbmqhelm repo updateCreate a namespace for TBMQ and its dependencies:
kubectl create namespace tbmqEvery 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:
helm install pgo oci://registry.developers.crunchydata.com/crunchydata/pgo \ --version 6.0.1 -n tbmqkubectl wait --for=condition=Ready pod -l postgres-operator.crunchydata.com/control-plane=pgo \ -n tbmq --timeout=180sCreate a PostgreSQL 17 cluster with the thingsboard_mqtt_broker database:
cat <<'EOF' | kubectl apply -n tbmq -f -apiVersion: postgres-operator.crunchydata.com/v1beta1kind: PostgresClustermetadata: name: tbmq-dbspec: 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: 10GiEOFWait 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:
until kubectl get pod -n tbmq -l postgres-operator.crunchydata.com/data=postgres 2>/dev/null | grep -q tbmq-db; do sleep 3; donekubectl wait --for=condition=Ready pod -l postgres-operator.crunchydata.com/data=postgres \ -n tbmq --timeout=300sPGO 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:
helm repo add strimzi https://strimzi.io/charts/helm repo updatehelm install strimzi strimzi/strimzi-kafka-operator --version 0.50.0 -n tbmqkubectl wait --for=condition=Ready pod -l name=strimzi-cluster-operator -n tbmq --timeout=180sCreate a three-node Kafka 4.0 cluster in KRaft mode:
cat <<'EOF' | kubectl apply -n tbmq -f -apiVersion: kafka.strimzi.io/v1kind: KafkaNodePoolmetadata: name: combined labels: strimzi.io/cluster: tbmq-kafkaspec: 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/v1kind: Kafkametadata: name: tbmq-kafka annotations: strimzi.io/node-pools: enabled strimzi.io/kraft: enabledspec: 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: {}EOFWait for the cluster; this takes a few minutes:
kubectl wait kafka/tbmq-kafka --for=condition=Ready -n tbmq --timeout=600sKafka is reachable at tbmq-kafka-kafka-bootstrap:9092.
Install a standalone Valkey without a password and wait for it:
helm repo add valkey https://valkey.io/valkey-helm/helm repo updatehelm install valkey valkey/valkey --version 0.9.3 -n tbmqkubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=valkey -n tbmq --timeout=180sValkey 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:
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:
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:
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:
kubectl rollout restart statefulset/my-tbmq-cluster-tbmq-node statefulset/my-tbmq-cluster-tbmq-ie -n tbmqThen 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: falsekafka.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_DROPPED_MSG_TOPIC_PROPERTIES: "cleanup.policy:delete;retention.ms:86400000;partitions:6;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" TB_KAFKA_IE_DOWNLINK_RABBITMQ_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_POSTGRESQL_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_TIMESCALEDB_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_REDIS_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_KAFKA_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_MQTT_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_MONGODB_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;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" TB_KAFKA_IE_DOWNLINK_RABBITMQ_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_POSTGRESQL_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_TIMESCALEDB_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_REDIS_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_KAFKA_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_MQTT_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_DOWNLINK_MONGODB_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;replication.factor:3" TB_KAFKA_IE_SOURCE_TOPIC_PROPERTIES: "retention.ms:604800000;retention.bytes:1048576000;partitions:6;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:
helm show values tbmq-helm-chart/tbmq-cluster > values.yamlThe 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: falseredis.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.
The chart defaults to the Community Edition images. In values.yaml, set the PE images in the tbmq.image and
tbmq-ie.image blocks:
tbmq: image: repository: thingsboard/tbmq-pe-node tag: 2.4.2PE
tbmq-ie: image: repository: thingsboard/tbmq-pe-integration-executor tag: 2.4.2PECreate a Secret with your license key in the tbmq namespace:
kubectl create secret generic tbmq-license -n tbmq \ --from-literal=license-key='YOUR_LICENSE_KEY'Reference it in the license section of values.yaml:
license: existingSecret: tbmq-licenseSet 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:
gcloud compute addresses create tbmq-http-lb-address --globalgcloud 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:
kubectl describe managedcertificate tbmq-managed-cert -n tbmqWith 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:
kubectl create secret generic tbmq-mqtts -n tbmq \ --from-file=server.pem=server-chain.pem \ --from-file=mqttserver_key.pem=server.keyEnable 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:
helm install my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq \ -f values.yaml \ --set installation.installDbSchema=truemy-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-clusterNAMESPACE: tbmqSTATUS: deployedREVISION: 1...The broker pods start after the schema exists. Wait until they are ready:
kubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600sGet the address of the Application Load Balancer:
kubectl get ingress my-tbmq-cluster-http-lb -n tbmqNAME CLASS HOSTS ADDRESS PORTS AGEmy-tbmq-cluster-http-lb <none> * 34.144.233.246 80 5mThe 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:
sysadmin@thingsboard.orgsysadminChange the password after the first sign-in.
Get the address of the Network Load Balancer:
kubectl get svc my-tbmq-cluster-mqtt-lb -n tbmqNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEmy-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 5mMQTT 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:
mosquitto_sub -h {EXTERNAL-IP} -p 1883 -u tbmq_websockets_username -t 'tbmq/demo/#' -v -q 1In another, publish:
mosquitto_pub -h {EXTERNAL-IP} -p 1883 -u tbmq_websockets_username -t 'tbmq/demo/hello' -m 'hello from gke' -q 1The 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:
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:
kubectl logs -f my-tbmq-cluster-tbmq-node-0 -n tbmqIf helm install fails with failed post-install, the schema install did not succeed. Read the install pod’s logs:
kubectl logs my-tbmq-cluster-install-pod -n tbmqIf 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:
kubectl apply --server-side --force-conflicts \ -f https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.50.0/strimzi-crds-0.50.0.yamlBroker 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:
kubectl rollout restart statefulset/my-tbmq-cluster-tbmq-node statefulset/my-tbmq-cluster-tbmq-ie -n tbmqIf the Ingress ADDRESS or the Service EXTERNAL-IP stays empty, its events give the reason:
kubectl describe ingress my-tbmq-cluster-http-lb -n tbmqkubectl describe svc my-tbmq-cluster-mqtt-lb -n tbmqingressClassName: 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.
To move a Community Edition release to PE, first upgrade it to the same TBMQ version as the target PE release. Then:
Switch values.yaml to PE.
In the values.yaml of your CE release, set the PE images and the license exactly as for a fresh PE install: see
Configure license and broker images, including the license Secret.
Stop TBMQ.
Scale the broker and Integration Executor to zero so nothing uses the database while it is migrated:
kubectl scale statefulset/my-tbmq-cluster-tbmq-node --replicas=0 -n tbmqkubectl scale statefulset/my-tbmq-cluster-tbmq-ie --replicas=0 -n tbmqRun the upgrade.
helm upgrade my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq \ -f values.yaml \ --set upgrade.upgradeDbSchema=true \ --set upgrade.fromVersion=ceThe migration converts the database to PE, then Helm starts the broker and Integration Executor on the PE images with their usual replica count.
Pass upgrade.fromVersion=ce only for this migration. On later PE upgrades, leave it out: with it, the migration fails.
Update the chart repository.
helm repo updateCompare versions.
The APP VERSION column is the TBMQ version. Compare your release with the latest chart:
helm list -n tbmqhelm search repo tbmq-helm-chart/tbmq-clusterUpdate values.yaml.
Export the new defaults and compare them with your file:
helm show values tbmq-helm-chart/tbmq-cluster > values-new.yamldiff values.yaml values-new.yamlCarry 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.2PE
tbmq-ie: image: tag: 2.4.2PERun the upgrade.
helm upgrade my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq \ -f values.yaml \ --set upgrade.upgradeDbSchema=trueA 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:
kubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600sIf 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.
helm uninstall my-tbmq-cluster -n tbmqThis removes the TBMQ resources of the release, and GKE deletes the two load balancers. It keeps the broker’s data volumes; delete them with:
kubectl delete pvc -n tbmq -l app=my-tbmq-cluster-tbmq-nodePostgreSQL, 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:
kubectl delete postgrescluster tbmq-db -n tbmqkubectl delete kafka tbmq-kafka -n tbmqkubectl delete kafkanodepool combined -n tbmqhelm uninstall valkey strimzi pgo -n tbmqkubectl delete namespace tbmqDeleting 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:
kubectl delete namespace tbmqThe managed services aren’t affected; Delete the GKE cluster covers them.
Uninstall TBMQ and its dependencies, as in the previous section.
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:
gcloud compute forwarding-rules list --filter="description~tbmq/my-tbmq-cluster" --format="table(name,IPAddress)"Delete the GKE cluster.
gcloud container clusters delete $TB_CLUSTER_NAME --region=$GCP_REGIONThe deletion takes about 10 minutes.
Delete the HTTPS static IP address, if you reserved one:
gcloud compute addresses delete tbmq-http-lb-address --globalDelete 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.
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
Choose the authentication provider that fits your clients. See Security overview.
Change broker settings through environment variables in tbmq.customEnv of your values.yaml.
See How to change configuration.
Track sessions, throughput, and resource usage as traffic grows. See Monitoring.
Was this helpful?