Project: TDengine (App Definition and Development / Database)
File: 05-helm.md

title: Use Helm to deploy TDengine sidebar_label: Helm description: This document describes how to deploy TDengine on Kubernetes by using Helm. Helm is a package manager for Kubernetes that can provide more capabilities in deploying on Kubernetes. ```bash curl -fsSL -o get_helm.sh \ https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 chmod +x get_helm.sh ./get_helm.sh ``` Helm uses the kubectl and kubeconfig configurations to perform Kubernetes operations. For more information, see the Rancher configuration for Kubernetes installation. To use TDengine Chart, download it from GitHub: ```bash wget https://github.com/taosdata/TDengine-Operator/raw/3.0/helm/tdengine-3.0.2.tgz ``` Query the storageclass of your Kubernetes deployment: ```bash kubectl get storageclass ``` With minikube, the default value is standard. Use Helm commands to install TDengine: ```bash helm install tdengine tdengine-3.0.2.tgz \ --set storage.className=<your storage class name> ``` You can configure a small storage size in minikube to ensure that your deployment does not exceed your available disk space. ```bash helm install tdengine tdengine-3.0.2.tgz \ --set storage.className=standard \ --set storage.dataSize=2Gi \ --set storage.logSize=10Mi ``` After TDengine is deployed, TDengine Chart outputs information about how to use TDengine: ```bash export POD_NAME=$(kubectl get pods --namespace default \ -l "app.kubernetes.io/name=tdengine,app.kubernetes.io/instance=tdengine" \ -o jsonpath="{.items[0].metadata.name}") kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes; show mnodes" kubectl --namespace default exec -it $POD_NAME -- taos ``` You can test the deployment by creating a table: ```bash kubectl --namespace default exec $POD_NAME -- \ taos -s "create database test; use test; create table t1 (ts timestamp, n int); insert into t1 values(now, 1)(now + 1s, 2); select * from t1;" ``` You can configure custom parameters in TDengine with the `values.yaml` file. Run the `helm show values` command to see all parameters supported by TDengine Chart. ```bash helm show values tdengine-3.0.2.tgz ``` Save the output of this command as `values.yaml`. Then you can modify this file with your desired values and use it to deploy a TDengine cluster: ```bash helm install tdengine tdengine-3.0.2.tgz -f values.yaml ``` The parameters are described as follows: ```yaml replicaCount: 1 image: prefix: tdengine/tdengine service: type: ClusterIP ports: tcp: [6030, 6041, 6042, 6043, 6044, 6046, 6047, 6048, 6049, 6060] udp: [6044, 6045] timezone: "Asia/Shanghai" resources: storage: className: "" dataSize: "100Gi" logSize: "10Gi" nodeSelectors: taosd: clusterDomainSuffix: "" taoscfg: CLUSTER: "1" TAOS_REPLICA: "1" ``` For information about scaling out your deployment, see Kubernetes. Additional Helm-specific is described as follows. First, obtain the name of the StatefulSet service for your deployment. ```bash export STS_NAME=$(kubectl get statefulset \ -l "app.kubernetes.io/name=tdengine" \ -o jsonpath="{.items[0].metadata.name}") ``` You can scale out your deployment by adding replicas. The following command scales a deployment to three nodes: ```bash kubectl scale --replicas 3 statefulset/$STS_NAME ``` Run the `show dnodes` and `show mnodes` commands to check whether the scale-out was successful. :::warning Exercise caution when scaling in a cluster. ::: Determine which dnodes you want to remove and drop them manually. ```bash kubectl --namespace default exec $POD_NAME -- \ cat /var/lib/taos/dnode/dnodeEps.json \ | jq '.dnodeInfos[1:] |map(.dnodeFqdn + ":" + (.dnodePort|tostring)) | .[]' -r kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes" kubectl --namespace default exec $POD_NAME -- taos -s 'drop dnode "<you dnode in list>"' ``` You can use Helm to remove your cluster: ```bash helm uninstall tdengine ``` However, Helm does not remove PVCs automatically. After you remove your cluster, manually remove all PVCs.