Trendz Analytics Kubernetes 1.16.x Upgrade Instructions
Prepare for upgrading Trendz Analytics
Obtain Trendz Kubernetes scripts
Use the Kubernetes configuration files from your original installation. If you no longer have them, clone the repository and fill in your configuration values as described in the installation guide. Run only the command for your target version.
Trendz 1.16.1.1 and later: the master branch holds the files of the latest Trendz release.
git clone https://github.com/thingsboard/trendz-k8s.git --depth 1An earlier version: clone the release branch of your target version. A release branch holds the files of the latest patch of its release. For example, release-1.16.0 holds the files of the latest 1.16.0.x patch:
git clone -b release-1.16.0 https://github.com/thingsboard/trendz-k8s.git --depth 1Connect to your Kubernetes cluster
Select the correct kube-config context before running any commands:
kubectl config get-contextskubectl config use-context <your-config-name>Set trendz as the default namespace, so the commands below run in it:
kubectl config set-context --current --namespace=trendzBack up the database
Back up the trendz database with pg_dump or your PostgreSQL provider's backup tools.
Upgrading Trendz Analytics to 1.16.1.3 (latest 1.16.1 patch)
Update the Kubernetes files
Check whether your cluster still runs on the files of Trendz 1.16.1 or earlier:
kubectl get configmap trendz-app-db-configIf the command prints the ConfigMap, follow Migrate Trendz Kubernetes files from 1.16.1 or earlier instead of this step. If it prints NotFound, go on here.
In your trendz-k8s folder, commit your edits so that Git can merge them with the latest changes, then pull. The commit stays in this folder only, but it holds your passwords and license key: do not push it anywhere. If Git has no name and email for this folder yet, set them first with git config user.name "Your Name" and git config user.email "you@example.com".
git commit -am "My configuration"git pull --no-rebaseIf Git says there is nothing to commit, the pull still runs.
If Git reports conflicts, open each file it names, keep your configuration values and take everything else from the new version. Then finish the merge:
git add -ugit commit --no-editApply the latest configuration. If you created the Secrets with kubectl create secret, leave out the first line, which applies trendz-db-app-secret.yml and trendz-python-executor-secret.yml. trendz-app-statefulset.yml and trendz-python-executor-deployment.yml are applied in the steps below.
kubectl apply -f trendz-db-app-secret.yml -f trendz-python-executor-secret.ymlkubectl apply -f trendz-app-env-config.yml -f trendz-app-files-config.ymlkubectl apply -f trendz-python-executor-env-config.yml -f trendz-python-executor-files-config.ymlkubectl apply -f trendz-app-shared-pvc.ymlkubectl apply -f trendz-cache-deployment.ymlkubectl apply -f trendz-python-executor-network-policy.ymlUpdate image versions
Set the image versions to 1.16.1.3. Do not apply the files yet.
trendz-app-statefulset.yml:thingsboard/trendz:1.16.1.3trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.1.3
Stop Trendz
kubectl scale statefulset trendz-app --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.1.3 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-env-config - secretRef: name: trendz-db-app-secret volumeMounts: - name: trendz-app-files-config mountPath: /trendz-config-files volumes: - name: trendz-app-files-config configMap: name: trendz-app-files-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap and Secret names and the namespace must match your trendz-app-statefulset.yml.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Starting Trendz installation ...…Trendz upgrade triggered…Start upgrading Trendz from version ……Trendz upgrade from ENV completed. Stopping as requested.The job does not mount /data, so it first runs the installation check. It finds the existing database and installs nothing.
Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-statefulset.ymlIf you run more than one pod, restore the replica count:
kubectl scale statefulset trendz-app --replicas=<pod-count>If you came here from Migrate Trendz Kubernetes files from 1.16.1 or earlier, go back to its last step once the new Trendz pod is running.
Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.1.2 (latest 1.16.1 patch)
Update the Kubernetes files
Check whether your cluster still runs on the files of Trendz 1.16.1 or earlier:
kubectl get configmap trendz-app-db-configIf the command prints the ConfigMap, follow Migrate Trendz Kubernetes files from 1.16.1 or earlier instead of this step. If it prints NotFound, go on here.
In your trendz-k8s folder, commit your edits so that Git can merge them with the latest changes, then pull. The commit stays in this folder only, but it holds your passwords and license key: do not push it anywhere. If Git has no name and email for this folder yet, set them first with git config user.name "Your Name" and git config user.email "you@example.com".
git commit -am "My configuration"git pull --no-rebaseIf Git says there is nothing to commit, the pull still runs.
If Git reports conflicts, open each file it names, keep your configuration values and take everything else from the new version. Then finish the merge:
git add -ugit commit --no-editApply the latest configuration. If you created the Secrets with kubectl create secret, leave out the first line, which applies trendz-db-app-secret.yml and trendz-python-executor-secret.yml. trendz-app-statefulset.yml and trendz-python-executor-deployment.yml are applied in the steps below.
kubectl apply -f trendz-db-app-secret.yml -f trendz-python-executor-secret.ymlkubectl apply -f trendz-app-env-config.yml -f trendz-app-files-config.ymlkubectl apply -f trendz-python-executor-env-config.yml -f trendz-python-executor-files-config.ymlkubectl apply -f trendz-app-shared-pvc.ymlkubectl apply -f trendz-cache-deployment.ymlkubectl apply -f trendz-python-executor-network-policy.ymlUpdate image versions
Set the image versions to 1.16.1.2. Do not apply the files yet.
trendz-app-statefulset.yml:thingsboard/trendz:1.16.1.2trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.1.2
Stop Trendz
kubectl scale statefulset trendz-app --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.1.2 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-env-config - secretRef: name: trendz-db-app-secret volumeMounts: - name: trendz-app-files-config mountPath: /trendz-config-files volumes: - name: trendz-app-files-config configMap: name: trendz-app-files-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap and Secret names and the namespace must match your trendz-app-statefulset.yml.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Starting Trendz installation ...…Trendz upgrade triggered…Start upgrading Trendz from version ……Trendz upgrade from ENV completed. Stopping as requested.The job does not mount /data, so it first runs the installation check. It finds the existing database and installs nothing.
Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-statefulset.ymlIf you run more than one pod, restore the replica count:
kubectl scale statefulset trendz-app --replicas=<pod-count>If you came here from Migrate Trendz Kubernetes files from 1.16.1 or earlier, go back to its last step once the new Trendz pod is running.
Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.1.1 (latest 1.16.1 patch)
Update the Kubernetes files
Check whether your cluster still runs on the files of Trendz 1.16.1 or earlier:
kubectl get configmap trendz-app-db-configIf the command prints the ConfigMap, follow Migrate Trendz Kubernetes files from 1.16.1 or earlier instead of this step. If it prints NotFound, go on here.
In your trendz-k8s folder, commit your edits so that Git can merge them with the latest changes, then pull. The commit stays in this folder only, but it holds your passwords and license key: do not push it anywhere. If Git has no name and email for this folder yet, set them first with git config user.name "Your Name" and git config user.email "you@example.com".
git commit -am "My configuration"git pull --no-rebaseIf Git says there is nothing to commit, the pull still runs.
If Git reports conflicts, open each file it names, keep your configuration values and take everything else from the new version. Then finish the merge:
git add -ugit commit --no-editApply the latest configuration. If you created the Secrets with kubectl create secret, leave out the first line, which applies trendz-db-app-secret.yml and trendz-python-executor-secret.yml. trendz-app-statefulset.yml and trendz-python-executor-deployment.yml are applied in the steps below.
kubectl apply -f trendz-db-app-secret.yml -f trendz-python-executor-secret.ymlkubectl apply -f trendz-app-env-config.yml -f trendz-app-files-config.ymlkubectl apply -f trendz-python-executor-env-config.yml -f trendz-python-executor-files-config.ymlkubectl apply -f trendz-app-shared-pvc.ymlkubectl apply -f trendz-cache-deployment.ymlkubectl apply -f trendz-python-executor-network-policy.ymlUpdate image versions
Set the image versions to 1.16.1.1. Do not apply the files yet.
trendz-app-statefulset.yml:thingsboard/trendz:1.16.1.1trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.1.1
Stop Trendz
kubectl scale statefulset trendz-app --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.1.1 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-env-config - secretRef: name: trendz-db-app-secret volumeMounts: - name: trendz-app-files-config mountPath: /trendz-config-files volumes: - name: trendz-app-files-config configMap: name: trendz-app-files-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap and Secret names and the namespace must match your trendz-app-statefulset.yml.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Starting Trendz installation ...…Trendz upgrade triggered…Start upgrading Trendz from version ……Trendz upgrade from ENV completed. Stopping as requested.The job does not mount /data, so it first runs the installation check. It finds the existing database and installs nothing.
Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-statefulset.ymlIf you run more than one pod, restore the replica count:
kubectl scale statefulset trendz-app --replicas=<pod-count>If you came here from Migrate Trendz Kubernetes files from 1.16.1 or earlier, go back to its last step once the new Trendz pod is running.
Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.1
Update image versions
Set the image versions to 1.16.1. Do not apply the files yet.
trendz-app-deployment.yml:thingsboard/trendz:1.16.1trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.1
Stop Trendz
kubectl scale deployment trendz-app-deployment --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.1 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-db-config volumeMounts: - name: trendz-app-config mountPath: /trendz-config-files volumes: - name: trendz-app-config configMap: name: trendz-app-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap names, keys and namespace must match your trendz-app-deployment.yml. Installations created before 1.15 use the keys conf and logback.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Start upgrading Trendz from version ……Current version is …, upgrade is not needed.Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-deployment.ymlIf you run more than one pod, restore the replica count:
kubectl scale deployment trendz-app-deployment --replicas=<pod-count>Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.0.2 (latest 1.16.0 patch)
Update image versions
Set the image versions to 1.16.0.2. Do not apply the files yet.
trendz-app-deployment.yml:thingsboard/trendz:1.16.0.2trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.0.2
Stop Trendz
kubectl scale deployment trendz-app-deployment --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.0.2 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-db-config volumeMounts: - name: trendz-app-config mountPath: /trendz-config-files volumes: - name: trendz-app-config configMap: name: trendz-app-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap names, keys and namespace must match your trendz-app-deployment.yml. Installations created before 1.15 use the keys conf and logback.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Start upgrading Trendz from version ……Current version is …, upgrade is not needed.Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-deployment.ymlIf you run more than one pod, restore the replica count:
kubectl scale deployment trendz-app-deployment --replicas=<pod-count>Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.0.1 (latest 1.16.0 patch)
Update image versions
Set the image versions to 1.16.0.1. Do not apply the files yet.
trendz-app-deployment.yml:thingsboard/trendz:1.16.0.1trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.0.1
Stop Trendz
kubectl scale deployment trendz-app-deployment --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.0.1 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-db-config volumeMounts: - name: trendz-app-config mountPath: /trendz-config-files volumes: - name: trendz-app-config configMap: name: trendz-app-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap names, keys and namespace must match your trendz-app-deployment.yml. Installations created before 1.15 use the keys conf and logback.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Start upgrading Trendz from version ……Current version is …, upgrade is not needed.Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-deployment.ymlIf you run more than one pod, restore the replica count:
kubectl scale deployment trendz-app-deployment --replicas=<pod-count>Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Upgrading Trendz Analytics to 1.16.0
Update image versions
Set the image versions to 1.16.0. Do not apply the files yet.
trendz-app-deployment.yml:thingsboard/trendz:1.16.0trendz-python-executor-deployment.yml:thingsboard/trendz-python-executor:1.16.0
Stop Trendz
kubectl scale deployment trendz-app-deployment --replicas=0kubectl wait --for=delete pod -l app=trendz-app-pod-label --timeout=120sIf the pods are already gone, kubectl wait may print no matching resources found. This is expected.
Create the upgrade job
apiVersion: batch/v1kind: Jobmetadata: name: trendz-upgrade namespace: trendzspec: backoffLimit: 0 template: spec: restartPolicy: Never containers: - name: trendz-upgrade image: thingsboard/trendz:1.16.0 env: - name: UPGRADE_TRENDZ value: "true" envFrom: - configMapRef: name: trendz-app-db-config volumeMounts: - name: trendz-app-config mountPath: /trendz-config-files volumes: - name: trendz-app-config configMap: name: trendz-app-config items: - key: trendz.conf path: trendz.conf - key: logback.xml path: logback.xmlThe ConfigMap names, keys and namespace must match your trendz-app-deployment.yml. Installations created before 1.15 use the keys conf and logback.
Run the upgrade job
kubectl apply -f trendz-upgrade.ymlkubectl wait --for=condition=complete job/trendz-upgrade --timeout=900sThe job does not retry. If the wait does not return, check the job log for the error (see the next step).
Verify the upgrade
kubectl logs job/trendz-upgradeExpected output:
Start upgrading Trendz from version ……Current version is …, upgrade is not needed.Delete the job
kubectl delete job trendz-upgradeStart Trendz
kubectl apply -f trendz-python-executor-deployment.ymlkubectl apply -f trendz-app-deployment.ymlIf you run more than one pod, restore the replica count:
kubectl scale deployment trendz-app-deployment --replicas=<pod-count>Sync Trendz with ThingsBoard
After the upgrade, sync Trendz with ThingsBoard to update widgets and JS modules automatically. See the sync instructions for details.
Was this helpful?