Commit f2974532c607ea239aff63bf0885628496f13bd4
1 parent
397a97ce
K8S scripts moved to separate repository
Showing
25 changed files
with
0 additions
and
2169 deletions
k8s/.env
deleted
100644 → 0
1 | -# Can be either basic (with single instance of Zookeeper, Kafka and Redis) or high-availability (with Zookeeper, Kafka and Redis in cluster modes). | |
2 | -# According to the deployment type corresponding kubernetes resources will be deployed (see content of the directories ./basic and ./high-availability for details). | |
3 | -DEPLOYMENT_TYPE=basic | |
4 | - | |
5 | -# Database used by ThingsBoard, can be either postgres (PostgreSQL) or hybrid (PostgreSQL for entities database and Cassandra for timeseries database). | |
6 | -# According to the database type corresponding kubernetes resources will be deployed (see postgres.yml, cassandra.yml for details). | |
7 | -DATABASE=postgres | |
8 | - |
k8s/README.md
deleted
100644 → 0
1 | -# Kubernetes resources configuration for ThingsBoard Microservices | |
2 | - | |
3 | -This folder containing scripts and Kubernetes resources configurations to run ThingsBoard in Microservices mode. | |
4 | - | |
5 | -## Prerequisites | |
6 | - | |
7 | -ThingsBoard Microservices run on the Kubernetes cluster. | |
8 | -You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. | |
9 | -If you do not have a cluster already, you can create one by using [Minikube](https://kubernetes.io/docs/setup/minikube), | |
10 | -or you can choose any other available [Kubernetes cluster deployment solutions](https://kubernetes.io/docs/setup/pick-right-solution/). | |
11 | - | |
12 | -### Enable ingress addon | |
13 | - | |
14 | -By default ingress addon is disabled in the Minikube, and available only in cluster providers. | |
15 | -To enable ingress, please execute the following command: | |
16 | - | |
17 | -` | |
18 | -$ minikube addons enable ingress | |
19 | -` | |
20 | - | |
21 | -## Installation | |
22 | - | |
23 | -Before performing initial installation you can configure the type of database to be used with ThingsBoard and the type of deployment. | |
24 | -To set database type change the value of `DATABASE` variable in `.env` file to one of the following: | |
25 | - | |
26 | -- `postgres` - use PostgreSQL database; | |
27 | -- `hybrid` - use PostgreSQL for entities database and Cassandra for timeseries database; | |
28 | - | |
29 | -**NOTE**: According to the database type corresponding kubernetes resources will be deployed (see `postgres.yml`, `cassandra.yml` for details). | |
30 | - | |
31 | -To set deployment type change the value of `DEPLOYMENT_TYPE` variable in `.env` file to one of the following: | |
32 | - | |
33 | -- `basic` - startup with a single instance of Zookeeper, Kafka and Redis; | |
34 | -- `high-availability` - startup with Zookeeper, Kafka, and Redis in cluster modes; | |
35 | - | |
36 | -**NOTE**: According to the deployment type corresponding kubernetes resources will be deployed (see the content of the directories `./basic` and `./high-availability` for details). | |
37 | - | |
38 | -Execute the following command to run the installation: | |
39 | - | |
40 | -` | |
41 | -$ ./k8s-install-tb.sh --loadDemo | |
42 | -` | |
43 | - | |
44 | -Where: | |
45 | - | |
46 | -- `--loadDemo` - optional argument. Whether to load additional demo data. | |
47 | - | |
48 | -## Running | |
49 | - | |
50 | -Execute the following command to deploy third-party resources: | |
51 | - | |
52 | -` | |
53 | -$ ./k8s-deploy-thirdparty.sh | |
54 | -` | |
55 | - | |
56 | -Type **'yes'** when prompted, if you are running ThingsBoard in `high-availability` `DEPLOYMENT_TYPE` for the first time and don't have configured Redis cluster. | |
57 | - | |
58 | -Execute the following command to deploy resources: | |
59 | - | |
60 | -` | |
61 | -$ ./k8s-deploy-resources.sh | |
62 | -` | |
63 | - | |
64 | -After a while when all resources will be successfully started you can open `http://{your-cluster-ip}` in your browser (for ex. `http://192.168.99.101`). | |
65 | -You should see the ThingsBoard login page. | |
66 | - | |
67 | -Use the following default credentials: | |
68 | - | |
69 | -- **System Administrator**: sysadmin@thingsboard.org / sysadmin | |
70 | - | |
71 | -If you installed DataBase with demo data (using `--loadDemo` flag) you can also use the following credentials: | |
72 | - | |
73 | -- **Tenant Administrator**: tenant@thingsboard.org / tenant | |
74 | -- **Customer User**: customer@thingsboard.org / customer | |
75 | - | |
76 | -In case of any issues, you can examine service logs for errors. | |
77 | -For example to see ThingsBoard node logs execute the following commands: | |
78 | - | |
79 | -1) Get the list of the running tb-node pods: | |
80 | - | |
81 | -` | |
82 | -$ kubectl get pods -l app=tb-node | |
83 | -` | |
84 | - | |
85 | -2) Fetch logs of the tb-node pod: | |
86 | - | |
87 | -` | |
88 | -$ kubectl logs -f [tb-node-pod-name] | |
89 | -` | |
90 | - | |
91 | -Where: | |
92 | - | |
93 | -- `tb-node-pod-name` - tb-node pod name obtained from the list of the running tb-node pods. | |
94 | - | |
95 | -Or use `kubectl get pods` to see the state of all the pods. | |
96 | -Or use `kubectl get services` to see the state of all the services. | |
97 | -Or use `kubectl get deployments` to see the state of all the deployments. | |
98 | -See [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) command reference for details. | |
99 | - | |
100 | -Execute the following command to delete all ThingsBoard microservices: | |
101 | - | |
102 | -` | |
103 | -$ ./k8s-delete-resources.sh | |
104 | -` | |
105 | - | |
106 | -Execute the following command to delete all third-party microservices: | |
107 | - | |
108 | -` | |
109 | -$ ./k8s-delete-thirdparty.sh | |
110 | -` | |
111 | - | |
112 | -Execute the following command to delete all resources (including database): | |
113 | - | |
114 | -` | |
115 | -$ ./k8s-delete-all.sh | |
116 | -` | |
117 | - | |
118 | -## Upgrading | |
119 | - | |
120 | -In case when database upgrade is needed, execute the following commands: | |
121 | - | |
122 | -``` | |
123 | -$ ./k8s-delete-resources.sh | |
124 | -$ ./k8s-upgrade-tb.sh --fromVersion=[FROM_VERSION] | |
125 | -$ ./k8s-deploy-resources.sh | |
126 | -``` | |
127 | - | |
128 | -Where: | |
129 | - | |
130 | -- `FROM_VERSION` - from which version upgrade should be started. See [Upgrade Instructions](https://thingsboard.io/docs/user-guide/install/upgrade-instructions) for valid `fromVersion` values. |
k8s/basic/tb-node-cache-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-node-cache-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-node-cache-config | |
24 | -data: | |
25 | - CACHE_TYPE: redis | |
26 | - REDIS_HOST: tb-redis | |
\ No newline at end of file |
k8s/basic/thirdparty.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: apps/v1 | |
18 | -kind: Deployment | |
19 | -metadata: | |
20 | - name: zookeeper | |
21 | - namespace: thingsboard | |
22 | -spec: | |
23 | - selector: | |
24 | - matchLabels: | |
25 | - app: zookeeper | |
26 | - template: | |
27 | - metadata: | |
28 | - labels: | |
29 | - app: zookeeper | |
30 | - spec: | |
31 | - containers: | |
32 | - - name: server | |
33 | - imagePullPolicy: Always | |
34 | - image: zookeeper:3.5 | |
35 | - ports: | |
36 | - - containerPort: 2181 | |
37 | - readinessProbe: | |
38 | - periodSeconds: 5 | |
39 | - tcpSocket: | |
40 | - port: 2181 | |
41 | - livenessProbe: | |
42 | - initialDelaySeconds: 15 | |
43 | - periodSeconds: 5 | |
44 | - tcpSocket: | |
45 | - port: 2181 | |
46 | - env: | |
47 | - - name: ZOO_MY_ID | |
48 | - value: "1" | |
49 | - - name: ZOO_SERVERS | |
50 | - value: "server.1=0.0.0.0:2888:3888;0.0.0.0:2181" | |
51 | - restartPolicy: Always | |
52 | ---- | |
53 | -apiVersion: v1 | |
54 | -kind: Service | |
55 | -metadata: | |
56 | - name: zookeeper | |
57 | - namespace: thingsboard | |
58 | -spec: | |
59 | - type: ClusterIP | |
60 | - selector: | |
61 | - app: zookeeper | |
62 | - ports: | |
63 | - - name: zk-port | |
64 | - port: 2181 | |
65 | ---- | |
66 | -apiVersion: apps/v1 | |
67 | -kind: Deployment | |
68 | -metadata: | |
69 | - name: tb-kafka | |
70 | - namespace: thingsboard | |
71 | -spec: | |
72 | - selector: | |
73 | - matchLabels: | |
74 | - app: tb-kafka | |
75 | - template: | |
76 | - metadata: | |
77 | - labels: | |
78 | - app: tb-kafka | |
79 | - spec: | |
80 | - containers: | |
81 | - - name: server | |
82 | - imagePullPolicy: Always | |
83 | - image: wurstmeister/kafka:2.12-2.2.1 | |
84 | - ports: | |
85 | - - containerPort: 9092 | |
86 | - readinessProbe: | |
87 | - periodSeconds: 20 | |
88 | - tcpSocket: | |
89 | - port: 9092 | |
90 | - livenessProbe: | |
91 | - initialDelaySeconds: 25 | |
92 | - periodSeconds: 5 | |
93 | - tcpSocket: | |
94 | - port: 9092 | |
95 | - env: | |
96 | - - name: KAFKA_ZOOKEEPER_CONNECT | |
97 | - value: "zookeeper:2181" | |
98 | - - name: KAFKA_LISTENERS | |
99 | - value: "INSIDE://:9093,OUTSIDE://:9092" | |
100 | - - name: KAFKA_ADVERTISED_LISTENERS | |
101 | - value: "INSIDE://:9093,OUTSIDE://tb-kafka:9092" | |
102 | - - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP | |
103 | - value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT" | |
104 | - - name: KAFKA_INTER_BROKER_LISTENER_NAME | |
105 | - value: "INSIDE" | |
106 | - - name: KAFKA_CREATE_TOPICS | |
107 | - value: "js_eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_rule_engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600" | |
108 | - - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE | |
109 | - value: "false" | |
110 | - - name: KAFKA_LOG_RETENTION_BYTES | |
111 | - value: "1073741824" | |
112 | - - name: KAFKA_LOG_SEGMENT_BYTES | |
113 | - value: "268435456" | |
114 | - - name: KAFKA_LOG_RETENTION_MS | |
115 | - value: "300000" | |
116 | - - name: KAFKA_LOG_CLEANUP_POLICY | |
117 | - value: "delete" | |
118 | - restartPolicy: Always | |
119 | ---- | |
120 | -apiVersion: v1 | |
121 | -kind: Service | |
122 | -metadata: | |
123 | - name: tb-kafka | |
124 | - namespace: thingsboard | |
125 | -spec: | |
126 | - type: ClusterIP | |
127 | - selector: | |
128 | - app: tb-kafka | |
129 | - ports: | |
130 | - - name: tb-kafka-port | |
131 | - port: 9092 | |
132 | ---- | |
133 | -apiVersion: apps/v1 | |
134 | -kind: Deployment | |
135 | -metadata: | |
136 | - name: tb-redis | |
137 | - namespace: thingsboard | |
138 | -spec: | |
139 | - selector: | |
140 | - matchLabels: | |
141 | - app: tb-redis | |
142 | - template: | |
143 | - metadata: | |
144 | - labels: | |
145 | - app: tb-redis | |
146 | - spec: | |
147 | - containers: | |
148 | - - name: server | |
149 | - imagePullPolicy: Always | |
150 | - image: redis:4.0 | |
151 | - ports: | |
152 | - - containerPort: 6379 | |
153 | - readinessProbe: | |
154 | - periodSeconds: 5 | |
155 | - tcpSocket: | |
156 | - port: 6379 | |
157 | - livenessProbe: | |
158 | - periodSeconds: 5 | |
159 | - tcpSocket: | |
160 | - port: 6379 | |
161 | - volumeMounts: | |
162 | - - mountPath: /data | |
163 | - name: redis-data | |
164 | - volumes: | |
165 | - - name: redis-data | |
166 | - emptyDir: {} | |
167 | - restartPolicy: Always | |
168 | ---- | |
169 | -apiVersion: v1 | |
170 | -kind: Service | |
171 | -metadata: | |
172 | - name: tb-redis | |
173 | - namespace: thingsboard | |
174 | -spec: | |
175 | - type: ClusterIP | |
176 | - selector: | |
177 | - app: tb-redis | |
178 | - ports: | |
179 | - - name: tb-redis-port | |
180 | - port: 6379 | |
181 | ---- | |
\ No newline at end of file |
k8s/common/cassandra.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: storage.k8s.io/v1 | |
18 | -kind: StorageClass | |
19 | -metadata: | |
20 | - name: fast | |
21 | - namespace: thingsboard | |
22 | -provisioner: k8s.io/minikube-hostpath | |
23 | -parameters: | |
24 | - type: pd-ssd | |
25 | ---- | |
26 | -apiVersion: v1 | |
27 | -kind: ConfigMap | |
28 | -metadata: | |
29 | - name: cassandra-probe-config | |
30 | - namespace: thingsboard | |
31 | - labels: | |
32 | - name: cassandra-probe-config | |
33 | -data: | |
34 | - probe: | | |
35 | - if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then | |
36 | - if [[ $DEBUG ]]; then | |
37 | - echo "UN"; | |
38 | - fi | |
39 | - exit 0; | |
40 | - else | |
41 | - if [[ $DEBUG ]]; then | |
42 | - echo "Not Up"; | |
43 | - fi | |
44 | - exit 1; | |
45 | - fi | |
46 | ---- | |
47 | -apiVersion: apps/v1 | |
48 | -kind: StatefulSet | |
49 | -metadata: | |
50 | - name: cassandra | |
51 | - namespace: thingsboard | |
52 | - labels: | |
53 | - app: cassandra | |
54 | -spec: | |
55 | - serviceName: cassandra | |
56 | - replicas: 1 | |
57 | - selector: | |
58 | - matchLabels: | |
59 | - app: cassandra | |
60 | - template: | |
61 | - metadata: | |
62 | - labels: | |
63 | - app: cassandra | |
64 | - spec: | |
65 | - volumes: | |
66 | - - name: cassandra-probe-config | |
67 | - configMap: | |
68 | - name: cassandra-probe-config | |
69 | - items: | |
70 | - - key: probe | |
71 | - path: ready-probe.sh | |
72 | - mode: 0777 | |
73 | - terminationGracePeriodSeconds: 1800 | |
74 | - containers: | |
75 | - - name: cassandra | |
76 | - image: cassandra:3.11.3 | |
77 | - imagePullPolicy: Always | |
78 | - ports: | |
79 | - - containerPort: 7000 | |
80 | - name: intra-node | |
81 | - - containerPort: 7001 | |
82 | - name: tls-intra-node | |
83 | - - containerPort: 7199 | |
84 | - name: jmx | |
85 | - - containerPort: 9042 | |
86 | - name: cql | |
87 | - - containerPort: 9160 | |
88 | - name: thrift | |
89 | - resources: | |
90 | - limits: | |
91 | - cpu: "1000m" | |
92 | - memory: 2Gi | |
93 | - requests: | |
94 | - cpu: "1000m" | |
95 | - memory: 2Gi | |
96 | - securityContext: | |
97 | - capabilities: | |
98 | - add: | |
99 | - - IPC_LOCK | |
100 | - lifecycle: | |
101 | - preStop: | |
102 | - exec: | |
103 | - command: | |
104 | - - /bin/sh | |
105 | - - -c | |
106 | - - nodetool drain | |
107 | - env: | |
108 | - - name: CASSANDRA_SEEDS | |
109 | - value: "cassandra-0.cassandra.thingsboard.svc.cluster.local" | |
110 | - - name: MAX_HEAP_SIZE | |
111 | - value: 1024M | |
112 | - - name: HEAP_NEWSIZE | |
113 | - value: 256M | |
114 | - - name: CASSANDRA_CLUSTER_NAME | |
115 | - value: "Thingsboard Cluster" | |
116 | - - name: CASSANDRA_DC | |
117 | - value: "datacenter1" | |
118 | - - name: CASSANDRA_RACK | |
119 | - value: "Rack-Thingsboard-Cluster" | |
120 | - - name: CASSANDRA_AUTO_BOOTSTRAP | |
121 | - value: "false" | |
122 | - - name: CASSANDRA_ENDPOINT_SNITCH | |
123 | - value: GossipingPropertyFileSnitch | |
124 | - - name: POD_IP | |
125 | - valueFrom: | |
126 | - fieldRef: | |
127 | - fieldPath: status.podIP | |
128 | - readinessProbe: | |
129 | - exec: | |
130 | - command: | |
131 | - - /bin/bash | |
132 | - - -c | |
133 | - - /probe/ready-probe.sh | |
134 | - initialDelaySeconds: 60 | |
135 | - timeoutSeconds: 5 | |
136 | - volumeMounts: | |
137 | - - name: cassandra-probe-config | |
138 | - mountPath: /probe | |
139 | - - name: cassandra-data | |
140 | - mountPath: /var/lib/cassandra | |
141 | - volumeClaimTemplates: | |
142 | - - metadata: | |
143 | - name: cassandra-data | |
144 | - spec: | |
145 | - accessModes: [ "ReadWriteOnce" ] | |
146 | - storageClassName: fast | |
147 | - resources: | |
148 | - requests: | |
149 | - storage: 1Gi | |
150 | ---- | |
151 | -apiVersion: v1 | |
152 | -kind: Service | |
153 | -metadata: | |
154 | - labels: | |
155 | - app: cassandra | |
156 | - name: cassandra | |
157 | - namespace: thingsboard | |
158 | -spec: | |
159 | - clusterIP: None | |
160 | - ports: | |
161 | - - port: 9042 | |
162 | - selector: | |
163 | - app: cassandra | |
164 | ---- |
k8s/common/database-setup.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: Pod | |
19 | -metadata: | |
20 | - name: tb-db-setup | |
21 | - namespace: thingsboard | |
22 | -spec: | |
23 | - volumes: | |
24 | - - name: tb-node-config | |
25 | - configMap: | |
26 | - name: tb-node-config | |
27 | - items: | |
28 | - - key: conf | |
29 | - path: thingsboard.conf | |
30 | - - key: logback | |
31 | - path: logback.xml | |
32 | - containers: | |
33 | - - name: tb-db-setup | |
34 | - imagePullPolicy: Always | |
35 | - image: thingsboard/tb-node:latest | |
36 | - envFrom: | |
37 | - - configMapRef: | |
38 | - name: tb-node-db-config | |
39 | - volumeMounts: | |
40 | - - mountPath: /config | |
41 | - name: tb-node-config | |
42 | - command: ['sh', '-c', 'while [ ! -f /tmp/install-finished ]; do sleep 2; done;'] | |
43 | - restartPolicy: Never |
k8s/common/postgres.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: PersistentVolumeClaim | |
19 | -metadata: | |
20 | - name: postgres-pv-claim | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - app: postgres | |
24 | -spec: | |
25 | - accessModes: | |
26 | - - ReadWriteOnce | |
27 | - resources: | |
28 | - requests: | |
29 | - storage: 5Gi | |
30 | ---- | |
31 | -apiVersion: apps/v1 | |
32 | -kind: Deployment | |
33 | -metadata: | |
34 | - name: postgres | |
35 | - namespace: thingsboard | |
36 | - labels: | |
37 | - app: postgres | |
38 | -spec: | |
39 | - selector: | |
40 | - matchLabels: | |
41 | - app: postgres | |
42 | - template: | |
43 | - metadata: | |
44 | - labels: | |
45 | - app: postgres | |
46 | - spec: | |
47 | - volumes: | |
48 | - - name: postgres-data | |
49 | - persistentVolumeClaim: | |
50 | - claimName: postgres-pv-claim | |
51 | - containers: | |
52 | - - name: postgres | |
53 | - imagePullPolicy: Always | |
54 | - image: postgres:12 | |
55 | - ports: | |
56 | - - containerPort: 5432 | |
57 | - name: postgres | |
58 | - env: | |
59 | - - name: POSTGRES_DB | |
60 | - value: "thingsboard" | |
61 | - - name: POSTGRES_PASSWORD | |
62 | - value: "postgres" | |
63 | - - name: PGDATA | |
64 | - value: /var/lib/postgresql/data/pgdata | |
65 | - volumeMounts: | |
66 | - - mountPath: /var/lib/postgresql/data | |
67 | - name: postgres-data | |
68 | - livenessProbe: | |
69 | - exec: | |
70 | - command: | |
71 | - - pg_isready | |
72 | - - -h | |
73 | - - localhost | |
74 | - - -U | |
75 | - - postgres | |
76 | - initialDelaySeconds: 60 | |
77 | - timeoutSeconds: 30 | |
78 | - readinessProbe: | |
79 | - exec: | |
80 | - command: | |
81 | - - pg_isready | |
82 | - - -h | |
83 | - - localhost | |
84 | - - -U | |
85 | - - postgres | |
86 | - initialDelaySeconds: 5 | |
87 | - timeoutSeconds: 1 | |
88 | - restartPolicy: Always | |
89 | ---- | |
90 | -apiVersion: v1 | |
91 | -kind: Service | |
92 | -metadata: | |
93 | - name: tb-database | |
94 | - namespace: thingsboard | |
95 | -spec: | |
96 | - type: ClusterIP | |
97 | - selector: | |
98 | - app: postgres | |
99 | - ports: | |
100 | - - port: 5432 | |
101 | - name: postgres | |
102 | ---- |
k8s/common/tb-coap-transport-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-coap-transport-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-coap-transport-config | |
24 | -data: | |
25 | - conf: | | |
26 | - export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=/var/log/tb-coap-transport/${TB_SERVICE_ID}-gc.log:time,uptime,level,tags:filecount=10,filesize=10M" | |
27 | - export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-coap-transport/${TB_SERVICE_ID}-heapdump.bin" | |
28 | - export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" | |
29 | - export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" | |
30 | - export JAVA_OPTS="$JAVA_OPTS -XX:+ExitOnOutOfMemoryError" | |
31 | - export LOG_FILENAME=tb-coap-transport.out | |
32 | - export LOADER_PATH=/usr/share/tb-coap-transport/conf | |
33 | - logback: | | |
34 | - <!DOCTYPE configuration> | |
35 | - <configuration scan="true" scanPeriod="10 seconds"> | |
36 | - | |
37 | - <appender name="fileLogAppender" | |
38 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
39 | - <file>/var/log/tb-coap-transport/${TB_SERVICE_ID}/tb-coap-transport.log</file> | |
40 | - <rollingPolicy | |
41 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
42 | - <fileNamePattern>/var/log/tb-coap-transport/${TB_SERVICE_ID}/tb-coap-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
43 | - <maxFileSize>100MB</maxFileSize> | |
44 | - <maxHistory>30</maxHistory> | |
45 | - <totalSizeCap>3GB</totalSizeCap> | |
46 | - </rollingPolicy> | |
47 | - <encoder> | |
48 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
49 | - </encoder> | |
50 | - </appender> | |
51 | - | |
52 | - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
53 | - <encoder> | |
54 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
55 | - </encoder> | |
56 | - </appender> | |
57 | - | |
58 | - <logger name="org.thingsboard.server" level="INFO" /> | |
59 | - | |
60 | - <root level="INFO"> | |
61 | - <appender-ref ref="fileLogAppender"/> | |
62 | - <appender-ref ref="STDOUT"/> | |
63 | - </root> | |
64 | - | |
65 | - </configuration> |
k8s/common/tb-http-transport-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-http-transport-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-http-transport-config | |
24 | -data: | |
25 | - conf: | | |
26 | - export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=/var/log/tb-http-transport/${TB_SERVICE_ID}-gc.log:time,uptime,level,tags:filecount=10,filesize=10M" | |
27 | - export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-http-transport/${TB_SERVICE_ID}-heapdump.bin" | |
28 | - export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" | |
29 | - export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" | |
30 | - export JAVA_OPTS="$JAVA_OPTS -XX:+ExitOnOutOfMemoryError" | |
31 | - export LOG_FILENAME=tb-http-transport.out | |
32 | - export LOADER_PATH=/usr/share/tb-http-transport/conf | |
33 | - logback: | | |
34 | - <!DOCTYPE configuration> | |
35 | - <configuration scan="true" scanPeriod="10 seconds"> | |
36 | - | |
37 | - <appender name="fileLogAppender" | |
38 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
39 | - <file>/var/log/tb-http-transport/${TB_SERVICE_ID}/tb-http-transport.log</file> | |
40 | - <rollingPolicy | |
41 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
42 | - <fileNamePattern>/var/log/tb-http-transport/${TB_SERVICE_ID}/tb-http-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
43 | - <maxFileSize>100MB</maxFileSize> | |
44 | - <maxHistory>30</maxHistory> | |
45 | - <totalSizeCap>3GB</totalSizeCap> | |
46 | - </rollingPolicy> | |
47 | - <encoder> | |
48 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
49 | - </encoder> | |
50 | - </appender> | |
51 | - | |
52 | - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
53 | - <encoder> | |
54 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
55 | - </encoder> | |
56 | - </appender> | |
57 | - | |
58 | - <logger name="org.thingsboard.server" level="INFO" /> | |
59 | - | |
60 | - <root level="INFO"> | |
61 | - <appender-ref ref="fileLogAppender"/> | |
62 | - <appender-ref ref="STDOUT"/> | |
63 | - </root> | |
64 | - | |
65 | - </configuration> |
k8s/common/tb-mqtt-transport-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-mqtt-transport-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-mqtt-transport-config | |
24 | -data: | |
25 | - conf: | | |
26 | - export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=/var/log/tb-mqtt-transport/${TB_SERVICE_ID}-gc.log:time,uptime,level,tags:filecount=10,filesize=10M" | |
27 | - export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-mqtt-transport/${TB_SERVICE_ID}-heapdump.bin" | |
28 | - export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" | |
29 | - export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" | |
30 | - export JAVA_OPTS="$JAVA_OPTS -XX:+ExitOnOutOfMemoryError" | |
31 | - export LOG_FILENAME=tb-mqtt-transport.out | |
32 | - export LOADER_PATH=/usr/share/tb-mqtt-transport/conf | |
33 | - logback: | | |
34 | - <!DOCTYPE configuration> | |
35 | - <configuration scan="true" scanPeriod="10 seconds"> | |
36 | - | |
37 | - <appender name="fileLogAppender" | |
38 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
39 | - <file>/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/tb-mqtt-transport.log</file> | |
40 | - <rollingPolicy | |
41 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
42 | - <fileNamePattern>/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/tb-mqtt-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
43 | - <maxFileSize>100MB</maxFileSize> | |
44 | - <maxHistory>30</maxHistory> | |
45 | - <totalSizeCap>3GB</totalSizeCap> | |
46 | - </rollingPolicy> | |
47 | - <encoder> | |
48 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
49 | - </encoder> | |
50 | - </appender> | |
51 | - | |
52 | - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
53 | - <encoder> | |
54 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
55 | - </encoder> | |
56 | - </appender> | |
57 | - | |
58 | - <logger name="org.thingsboard.server" level="INFO" /> | |
59 | - | |
60 | - <root level="INFO"> | |
61 | - <appender-ref ref="fileLogAppender"/> | |
62 | - <appender-ref ref="STDOUT"/> | |
63 | - </root> | |
64 | - | |
65 | - </configuration> |
k8s/common/tb-namespace.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: Namespace | |
19 | -metadata: | |
20 | - name: thingsboard | |
21 | - labels: | |
22 | - name: thingsboard |
k8s/common/tb-node-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-node-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-node-config | |
24 | -data: | |
25 | - conf: | | |
26 | - export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data" | |
27 | - export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=/var/log/thingsboard/${TB_SERVICE_ID}-gc.log:time,uptime,level,tags:filecount=10,filesize=10M" | |
28 | - export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/thingsboard/${TB_SERVICE_ID}-heapdump.bin" | |
29 | - export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" | |
30 | - export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" | |
31 | - export JAVA_OPTS="$JAVA_OPTS -XX:+ExitOnOutOfMemoryError" | |
32 | - export LOG_FILENAME=thingsboard.out | |
33 | - export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions | |
34 | - logback: | | |
35 | - <!DOCTYPE configuration> | |
36 | - <configuration scan="true" scanPeriod="10 seconds"> | |
37 | - | |
38 | - <appender name="fileLogAppender" | |
39 | - class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
40 | - <file>/var/log/thingsboard/${TB_SERVICE_ID}/thingsboard.log</file> | |
41 | - <rollingPolicy | |
42 | - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
43 | - <fileNamePattern>/var/log/thingsboard/${TB_SERVICE_ID}/thingsboard.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
44 | - <maxFileSize>100MB</maxFileSize> | |
45 | - <maxHistory>30</maxHistory> | |
46 | - <totalSizeCap>3GB</totalSizeCap> | |
47 | - </rollingPolicy> | |
48 | - <encoder> | |
49 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
50 | - </encoder> | |
51 | - </appender> | |
52 | - | |
53 | - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
54 | - <encoder> | |
55 | - <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
56 | - </encoder> | |
57 | - </appender> | |
58 | - | |
59 | - <logger name="org.thingsboard.server" level="INFO" /> | |
60 | - <logger name="com.google.common.util.concurrent.AggregateFuture" level="OFF" /> | |
61 | - | |
62 | - <root level="INFO"> | |
63 | - <appender-ref ref="fileLogAppender"/> | |
64 | - <appender-ref ref="STDOUT"/> | |
65 | - </root> | |
66 | - | |
67 | - </configuration> |
k8s/common/tb-node-hybrid-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-node-db-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-node-db-config | |
24 | -data: | |
25 | - SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect | |
26 | - SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver | |
27 | - SPRING_DATASOURCE_URL: jdbc:postgresql://tb-database:5432/thingsboard | |
28 | - SPRING_DATASOURCE_USERNAME: postgres | |
29 | - SPRING_DATASOURCE_PASSWORD: postgres | |
30 | - DATABASE_TS_TYPE: cassandra | |
31 | - CASSANDRA_URL: cassandra:9042 | |
32 | - CASSANDRA_SOCKET_READ_TIMEOUT: "60000" |
k8s/common/tb-node-postgres-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-node-db-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-node-db-config | |
24 | -data: | |
25 | - DATABASE_TS_TYPE: sql | |
26 | - SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect | |
27 | - SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver | |
28 | - SPRING_DATASOURCE_URL: jdbc:postgresql://tb-database:5432/thingsboard | |
29 | - SPRING_DATASOURCE_USERNAME: postgres | |
30 | - SPRING_DATASOURCE_PASSWORD: postgres |
k8s/common/tb-node.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: apps/v1 | |
18 | -kind: Deployment | |
19 | -metadata: | |
20 | - name: tb-node | |
21 | - namespace: thingsboard | |
22 | -spec: | |
23 | - replicas: 2 | |
24 | - selector: | |
25 | - matchLabels: | |
26 | - app: tb-node | |
27 | - template: | |
28 | - metadata: | |
29 | - labels: | |
30 | - app: tb-node | |
31 | - spec: | |
32 | - volumes: | |
33 | - - name: tb-node-config | |
34 | - configMap: | |
35 | - name: tb-node-config | |
36 | - items: | |
37 | - - key: conf | |
38 | - path: thingsboard.conf | |
39 | - - key: logback | |
40 | - path: logback.xml | |
41 | - containers: | |
42 | - - name: server | |
43 | - imagePullPolicy: Always | |
44 | - image: thingsboard/tb-node:latest | |
45 | - ports: | |
46 | - - containerPort: 8080 | |
47 | - name: http | |
48 | - - containerPort: 9001 | |
49 | - name: rpc | |
50 | - env: | |
51 | - - name: TB_SERVICE_ID | |
52 | - valueFrom: | |
53 | - fieldRef: | |
54 | - fieldPath: metadata.name | |
55 | - - name: TB_SERVICE_TYPE | |
56 | - value: "monolith" | |
57 | - - name: TB_QUEUE_TYPE | |
58 | - value: "kafka" | |
59 | - - name: ZOOKEEPER_ENABLED | |
60 | - value: "true" | |
61 | - - name: ZOOKEEPER_URL | |
62 | - value: "zookeeper:2181" | |
63 | - - name: TB_KAFKA_SERVERS | |
64 | - value: "tb-kafka:9092" | |
65 | - - name: JS_EVALUATOR | |
66 | - value: "remote" | |
67 | - - name: TRANSPORT_TYPE | |
68 | - value: "remote" | |
69 | - - name: HTTP_LOG_CONTROLLER_ERROR_STACK_TRACE | |
70 | - value: "false" | |
71 | - envFrom: | |
72 | - - configMapRef: | |
73 | - name: tb-node-db-config | |
74 | - - configMapRef: | |
75 | - name: tb-node-cache-config | |
76 | - volumeMounts: | |
77 | - - mountPath: /config | |
78 | - name: tb-node-config | |
79 | - livenessProbe: | |
80 | - httpGet: | |
81 | - path: /login | |
82 | - port: http | |
83 | - initialDelaySeconds: 300 | |
84 | - timeoutSeconds: 10 | |
85 | - restartPolicy: Always | |
86 | ---- | |
87 | -apiVersion: v1 | |
88 | -kind: Service | |
89 | -metadata: | |
90 | - name: tb-node | |
91 | - namespace: thingsboard | |
92 | -spec: | |
93 | - type: ClusterIP | |
94 | - selector: | |
95 | - app: tb-node | |
96 | - ports: | |
97 | - - port: 8080 | |
98 | - name: http | |
\ No newline at end of file |
k8s/common/thingsboard.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: apps/v1 | |
18 | -kind: Deployment | |
19 | -metadata: | |
20 | - name: tb-js-executor | |
21 | - namespace: thingsboard | |
22 | -spec: | |
23 | - replicas: 20 | |
24 | - selector: | |
25 | - matchLabels: | |
26 | - app: tb-js-executor | |
27 | - template: | |
28 | - metadata: | |
29 | - labels: | |
30 | - app: tb-js-executor | |
31 | - spec: | |
32 | - containers: | |
33 | - - name: server | |
34 | - imagePullPolicy: Always | |
35 | - image: thingsboard/tb-js-executor:latest | |
36 | - env: | |
37 | - - name: REMOTE_JS_EVAL_REQUEST_TOPIC | |
38 | - value: "js_eval.requests" | |
39 | - - name: TB_KAFKA_SERVERS | |
40 | - value: "tb-kafka:9092" | |
41 | - - name: LOGGER_LEVEL | |
42 | - value: "info" | |
43 | - - name: LOG_FOLDER | |
44 | - value: "logs" | |
45 | - - name: LOGGER_FILENAME | |
46 | - value: "tb-js-executor-%DATE%.log" | |
47 | - - name: DOCKER_MODE | |
48 | - value: "true" | |
49 | - - name: SCRIPT_BODY_TRACE_FREQUENCY | |
50 | - value: "1000" | |
51 | - restartPolicy: Always | |
52 | ---- | |
53 | -apiVersion: apps/v1 | |
54 | -kind: Deployment | |
55 | -metadata: | |
56 | - name: tb-mqtt-transport | |
57 | - namespace: thingsboard | |
58 | -spec: | |
59 | - replicas: 2 | |
60 | - selector: | |
61 | - matchLabels: | |
62 | - app: tb-mqtt-transport | |
63 | - template: | |
64 | - metadata: | |
65 | - labels: | |
66 | - app: tb-mqtt-transport | |
67 | - spec: | |
68 | - volumes: | |
69 | - - name: tb-mqtt-transport-config | |
70 | - configMap: | |
71 | - name: tb-mqtt-transport-config | |
72 | - items: | |
73 | - - key: conf | |
74 | - path: tb-mqtt-transport.conf | |
75 | - - key: logback | |
76 | - path: logback.xml | |
77 | - containers: | |
78 | - - name: server | |
79 | - imagePullPolicy: Always | |
80 | - image: thingsboard/tb-mqtt-transport:latest | |
81 | - ports: | |
82 | - - containerPort: 1883 | |
83 | - name: mqtt | |
84 | - env: | |
85 | - - name: TB_SERVICE_ID | |
86 | - valueFrom: | |
87 | - fieldRef: | |
88 | - fieldPath: metadata.name | |
89 | - - name: TB_QUEUE_TYPE | |
90 | - value: "kafka" | |
91 | - - name: MQTT_BIND_ADDRESS | |
92 | - value: "0.0.0.0" | |
93 | - - name: MQTT_BIND_PORT | |
94 | - value: "1883" | |
95 | - - name: MQTT_TIMEOUT | |
96 | - value: "10000" | |
97 | - - name: TB_KAFKA_SERVERS | |
98 | - value: "tb-kafka:9092" | |
99 | - volumeMounts: | |
100 | - - mountPath: /config | |
101 | - name: tb-mqtt-transport-config | |
102 | - readinessProbe: | |
103 | - periodSeconds: 20 | |
104 | - tcpSocket: | |
105 | - port: 1883 | |
106 | - livenessProbe: | |
107 | - initialDelaySeconds: 120 | |
108 | - periodSeconds: 20 | |
109 | - tcpSocket: | |
110 | - port: 1883 | |
111 | - restartPolicy: Always | |
112 | ---- | |
113 | -apiVersion: v1 | |
114 | -kind: Service | |
115 | -metadata: | |
116 | - name: tb-mqtt-transport | |
117 | - namespace: thingsboard | |
118 | -spec: | |
119 | - type: LoadBalancer | |
120 | - selector: | |
121 | - app: tb-mqtt-transport | |
122 | - ports: | |
123 | - - port: 1883 | |
124 | - targetPort: 1883 | |
125 | - name: mqtt | |
126 | ---- | |
127 | -apiVersion: apps/v1 | |
128 | -kind: Deployment | |
129 | -metadata: | |
130 | - name: tb-http-transport | |
131 | - namespace: thingsboard | |
132 | -spec: | |
133 | - replicas: 2 | |
134 | - selector: | |
135 | - matchLabels: | |
136 | - app: tb-http-transport | |
137 | - template: | |
138 | - metadata: | |
139 | - labels: | |
140 | - app: tb-http-transport | |
141 | - spec: | |
142 | - volumes: | |
143 | - - name: tb-http-transport-config | |
144 | - configMap: | |
145 | - name: tb-http-transport-config | |
146 | - items: | |
147 | - - key: conf | |
148 | - path: tb-http-transport.conf | |
149 | - - key: logback | |
150 | - path: logback.xml | |
151 | - containers: | |
152 | - - name: server | |
153 | - imagePullPolicy: Always | |
154 | - image: thingsboard/tb-http-transport:latest | |
155 | - ports: | |
156 | - - containerPort: 8080 | |
157 | - name: http | |
158 | - env: | |
159 | - - name: TB_SERVICE_ID | |
160 | - valueFrom: | |
161 | - fieldRef: | |
162 | - fieldPath: metadata.name | |
163 | - - name: TB_QUEUE_TYPE | |
164 | - value: "kafka" | |
165 | - - name: HTTP_BIND_ADDRESS | |
166 | - value: "0.0.0.0" | |
167 | - - name: HTTP_BIND_PORT | |
168 | - value: "8080" | |
169 | - - name: HTTP_REQUEST_TIMEOUT | |
170 | - value: "60000" | |
171 | - - name: TB_KAFKA_SERVERS | |
172 | - value: "tb-kafka:9092" | |
173 | - volumeMounts: | |
174 | - - mountPath: /config | |
175 | - name: tb-http-transport-config | |
176 | - readinessProbe: | |
177 | - periodSeconds: 20 | |
178 | - tcpSocket: | |
179 | - port: 8080 | |
180 | - livenessProbe: | |
181 | - initialDelaySeconds: 120 | |
182 | - periodSeconds: 20 | |
183 | - tcpSocket: | |
184 | - port: 8080 | |
185 | - restartPolicy: Always | |
186 | ---- | |
187 | -apiVersion: v1 | |
188 | -kind: Service | |
189 | -metadata: | |
190 | - name: tb-http-transport | |
191 | - namespace: thingsboard | |
192 | -spec: | |
193 | - type: ClusterIP | |
194 | - selector: | |
195 | - app: tb-http-transport | |
196 | - ports: | |
197 | - - port: 8080 | |
198 | - name: http | |
199 | ---- | |
200 | -apiVersion: apps/v1 | |
201 | -kind: Deployment | |
202 | -metadata: | |
203 | - name: tb-coap-transport | |
204 | - namespace: thingsboard | |
205 | -spec: | |
206 | - replicas: 2 | |
207 | - selector: | |
208 | - matchLabels: | |
209 | - app: tb-coap-transport | |
210 | - template: | |
211 | - metadata: | |
212 | - labels: | |
213 | - app: tb-coap-transport | |
214 | - spec: | |
215 | - volumes: | |
216 | - - name: tb-coap-transport-config | |
217 | - configMap: | |
218 | - name: tb-coap-transport-config | |
219 | - items: | |
220 | - - key: conf | |
221 | - path: tb-coap-transport.conf | |
222 | - - key: logback | |
223 | - path: logback.xml | |
224 | - containers: | |
225 | - - name: server | |
226 | - imagePullPolicy: Always | |
227 | - image: thingsboard/tb-coap-transport:latest | |
228 | - ports: | |
229 | - - containerPort: 5683 | |
230 | - name: coap | |
231 | - protocol: UDP | |
232 | - env: | |
233 | - - name: TB_SERVICE_ID | |
234 | - valueFrom: | |
235 | - fieldRef: | |
236 | - fieldPath: metadata.name | |
237 | - - name: TB_QUEUE_TYPE | |
238 | - value: "kafka" | |
239 | - - name: COAP_BIND_ADDRESS | |
240 | - value: "0.0.0.0" | |
241 | - - name: COAP_BIND_PORT | |
242 | - value: "5683" | |
243 | - - name: COAP_TIMEOUT | |
244 | - value: "10000" | |
245 | - - name: TB_KAFKA_SERVERS | |
246 | - value: "tb-kafka:9092" | |
247 | - volumeMounts: | |
248 | - - mountPath: /config | |
249 | - name: tb-coap-transport-config | |
250 | - restartPolicy: Always | |
251 | ---- | |
252 | -apiVersion: v1 | |
253 | -kind: Service | |
254 | -metadata: | |
255 | - name: tb-coap-transport | |
256 | - namespace: thingsboard | |
257 | -spec: | |
258 | - type: LoadBalancer | |
259 | - selector: | |
260 | - app: tb-coap-transport | |
261 | - ports: | |
262 | - - port: 5683 | |
263 | - name: coap | |
264 | - protocol: UDP | |
265 | ---- | |
266 | -apiVersion: apps/v1 | |
267 | -kind: Deployment | |
268 | -metadata: | |
269 | - name: tb-lwm2m-transport | |
270 | - namespace: thingsboard | |
271 | -spec: | |
272 | - replicas: 2 | |
273 | - selector: | |
274 | - matchLabels: | |
275 | - app: tb-lwm2m-transport | |
276 | - template: | |
277 | - metadata: | |
278 | - labels: | |
279 | - app: tb-lwm2m-transport | |
280 | - spec: | |
281 | - volumes: | |
282 | - - name: tb-lwm2m-transport-config | |
283 | - configMap: | |
284 | - name: tb-lwm2m-transport-config | |
285 | - items: | |
286 | - - key: conf | |
287 | - path: tb-lwm2m-transport.conf | |
288 | - - key: logback | |
289 | - path: logback.xml | |
290 | - containers: | |
291 | - - name: server | |
292 | - imagePullPolicy: Always | |
293 | - image: thingsboard/tb-lwm2m-transport:latest | |
294 | - ports: | |
295 | - - containerPort: 5685 | |
296 | - name: lwm2m | |
297 | - protocol: UDP | |
298 | - env: | |
299 | - - name: TB_SERVICE_ID | |
300 | - valueFrom: | |
301 | - fieldRef: | |
302 | - fieldPath: metadata.name | |
303 | - - name: TB_QUEUE_TYPE | |
304 | - value: "kafka" | |
305 | - - name: LWM2M_BIND_ADDRESS | |
306 | - value: "0.0.0.0" | |
307 | - - name: LWM2M_BIND_PORT | |
308 | - value: "5685" | |
309 | - - name: LWM2M_TIMEOUT | |
310 | - value: "10000" | |
311 | - - name: TB_KAFKA_SERVERS | |
312 | - value: "tb-kafka:9092" | |
313 | - volumeMounts: | |
314 | - - mountPath: /config | |
315 | - name: tb-lwm2m-transport-config | |
316 | - restartPolicy: Always | |
317 | ---- | |
318 | -apiVersion: v1 | |
319 | -kind: Service | |
320 | -metadata: | |
321 | - name: tb-lwm2m-transport | |
322 | - namespace: thingsboard | |
323 | -spec: | |
324 | - type: LoadBalancer | |
325 | - selector: | |
326 | - app: tb-lwm2m-transport | |
327 | - ports: | |
328 | - - port: 5685 | |
329 | - name: lwm2m | |
330 | - protocol: UDP | |
331 | ---- | |
332 | -apiVersion: apps/v1 | |
333 | -kind: Deployment | |
334 | -metadata: | |
335 | - name: tb-web-ui | |
336 | - namespace: thingsboard | |
337 | -spec: | |
338 | - replicas: 2 | |
339 | - selector: | |
340 | - matchLabels: | |
341 | - app: tb-web-ui | |
342 | - template: | |
343 | - metadata: | |
344 | - labels: | |
345 | - app: tb-web-ui | |
346 | - spec: | |
347 | - containers: | |
348 | - - name: server | |
349 | - imagePullPolicy: Always | |
350 | - image: thingsboard/tb-web-ui:latest | |
351 | - ports: | |
352 | - - containerPort: 8080 | |
353 | - name: http | |
354 | - env: | |
355 | - - name: HTTP_BIND_ADDRESS | |
356 | - value: "0.0.0.0" | |
357 | - - name: HTTP_BIND_PORT | |
358 | - value: "8080" | |
359 | - - name: TB_ENABLE_PROXY | |
360 | - value: "false" | |
361 | - - name: LOGGER_LEVEL | |
362 | - value: "info" | |
363 | - - name: LOG_FOLDER | |
364 | - value: "logs" | |
365 | - - name: LOGGER_FILENAME | |
366 | - value: "tb-web-ui-%DATE%.log" | |
367 | - - name: DOCKER_MODE | |
368 | - value: "true" | |
369 | - livenessProbe: | |
370 | - httpGet: | |
371 | - path: /index.html | |
372 | - port: http | |
373 | - initialDelaySeconds: 120 | |
374 | - timeoutSeconds: 10 | |
375 | - restartPolicy: Always | |
376 | ---- | |
377 | -apiVersion: v1 | |
378 | -kind: Service | |
379 | -metadata: | |
380 | - name: tb-web-ui | |
381 | - namespace: thingsboard | |
382 | -spec: | |
383 | - type: ClusterIP | |
384 | - selector: | |
385 | - app: tb-web-ui | |
386 | - ports: | |
387 | - - port: 8080 | |
388 | - name: http | |
389 | ---- | |
390 | -apiVersion: networking.k8s.io/v1beta1 | |
391 | -kind: Ingress | |
392 | -metadata: | |
393 | - name: tb-ingress | |
394 | - namespace: thingsboard | |
395 | - annotations: | |
396 | - nginx.ingress.kubernetes.io/use-regex: "true" | |
397 | - nginx.ingress.kubernetes.io/ssl-redirect: "false" | |
398 | - nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" | |
399 | -spec: | |
400 | - rules: | |
401 | - - http: | |
402 | - paths: | |
403 | - - path: /api/v1/.* | |
404 | - backend: | |
405 | - serviceName: tb-http-transport | |
406 | - servicePort: 8080 | |
407 | - - path: /api/.* | |
408 | - backend: | |
409 | - serviceName: tb-node | |
410 | - servicePort: 8080 | |
411 | - - path: /swagger.* | |
412 | - backend: | |
413 | - serviceName: tb-node | |
414 | - servicePort: 8080 | |
415 | - - path: /webjars.* | |
416 | - backend: | |
417 | - serviceName: tb-node | |
418 | - servicePort: 8080 | |
419 | - - path: /v2/.* | |
420 | - backend: | |
421 | - serviceName: tb-node | |
422 | - servicePort: 8080 | |
423 | - - path: /v3/.* | |
424 | - backend: | |
425 | - serviceName: tb-node | |
426 | - servicePort: 8080 | |
427 | - - path: /static/rulenode/.* | |
428 | - backend: | |
429 | - serviceName: tb-node | |
430 | - servicePort: 8080 | |
431 | - - path: /assets/help/.*/rulenode/.* | |
432 | - backend: | |
433 | - serviceName: tb-node | |
434 | - servicePort: 8080 | |
435 | - - path: /oauth2/.* | |
436 | - backend: | |
437 | - serviceName: tb-node | |
438 | - servicePort: 8080 | |
439 | - - path: /login/oauth2/.* | |
440 | - backend: | |
441 | - serviceName: tb-node | |
442 | - servicePort: 8080 | |
443 | - - path: / | |
444 | - backend: | |
445 | - serviceName: tb-web-ui | |
446 | - servicePort: 8080 | |
447 | - - path: /.* | |
448 | - backend: | |
449 | - serviceName: tb-web-ui | |
450 | - servicePort: 8080 | |
451 | ---- |
k8s/high-availability/tb-node-cache-configmap.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: v1 | |
18 | -kind: ConfigMap | |
19 | -metadata: | |
20 | - name: tb-node-cache-config | |
21 | - namespace: thingsboard | |
22 | - labels: | |
23 | - name: tb-node-cache-config | |
24 | -data: | |
25 | - CACHE_TYPE: redis | |
26 | - REDIS_CONNECTION_TYPE: cluster | |
27 | - REDIS_NODES: tb-redis:6379 | |
\ No newline at end of file |
k8s/high-availability/thirdparty.yml
deleted
100644 → 0
1 | -# | |
2 | -# Copyright © 2016-2021 The Thingsboard Authors | |
3 | -# | |
4 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -# you may not use this file except in compliance with the License. | |
6 | -# You may obtain a copy of the License at | |
7 | -# | |
8 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -# | |
10 | -# Unless required by applicable law or agreed to in writing, software | |
11 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -# See the License for the specific language governing permissions and | |
14 | -# limitations under the License. | |
15 | -# | |
16 | - | |
17 | -apiVersion: apps/v1 | |
18 | -kind: StatefulSet | |
19 | -metadata: | |
20 | - name: zookeeper | |
21 | - namespace: thingsboard | |
22 | -spec: | |
23 | - serviceName: "zookeeper" | |
24 | - replicas: 3 | |
25 | - podManagementPolicy: Parallel | |
26 | - selector: | |
27 | - matchLabels: | |
28 | - app: zookeeper | |
29 | - template: | |
30 | - metadata: | |
31 | - labels: | |
32 | - app: zookeeper | |
33 | - spec: | |
34 | - containers: | |
35 | - - name: zookeeper | |
36 | - imagePullPolicy: Always | |
37 | - image: zookeeper:3.5 | |
38 | - ports: | |
39 | - - containerPort: 2181 | |
40 | - name: client | |
41 | - - containerPort: 2888 | |
42 | - name: server | |
43 | - - containerPort: 3888 | |
44 | - name: election | |
45 | - readinessProbe: | |
46 | - periodSeconds: 60 | |
47 | - tcpSocket: | |
48 | - port: 2181 | |
49 | - livenessProbe: | |
50 | - periodSeconds: 60 | |
51 | - tcpSocket: | |
52 | - port: 2181 | |
53 | - env: | |
54 | - - name: ZOO_SERVERS | |
55 | - value: "server.0=zookeeper-0.zookeeper:2888:3888;2181 server.1=zookeeper-1.zookeeper:2888:3888;2181 server.2=zookeeper-2.zookeeper:2888:3888;2181" | |
56 | - - name: JVMFLAGS | |
57 | - value: "-Dzookeeper.electionPortBindRetry=0" | |
58 | - volumeMounts: | |
59 | - - name: data | |
60 | - mountPath: /data | |
61 | - readOnly: false | |
62 | - initContainers: | |
63 | - - command: | |
64 | - - /bin/bash | |
65 | - - -c | |
66 | - - |- | |
67 | - set -ex; | |
68 | - mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR"; | |
69 | - chown "$ZOO_USER:$ZOO_USER" "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" | |
70 | - if [[ ! -f "$ZOO_DATA_DIR/myid" ]]; then | |
71 | - echo $HOSTNAME| rev | cut -d "-" -f1 | rev > "$ZOO_DATA_DIR/myid" | |
72 | - fi | |
73 | - env: | |
74 | - - name: HOSTNAME | |
75 | - valueFrom: | |
76 | - fieldRef: | |
77 | - fieldPath: metadata.name | |
78 | - image: zookeeper:3.5 | |
79 | - imagePullPolicy: IfNotPresent | |
80 | - name: zookeeper-init | |
81 | - securityContext: | |
82 | - runAsUser: 0 | |
83 | - volumeMounts: | |
84 | - - name: data | |
85 | - mountPath: /data | |
86 | - readOnly: false | |
87 | - volumeClaimTemplates: | |
88 | - - metadata: | |
89 | - name: data | |
90 | - spec: | |
91 | - accessModes: [ "ReadWriteOnce" ] | |
92 | - resources: | |
93 | - requests: | |
94 | - storage: 100Mi | |
95 | ---- | |
96 | -apiVersion: v1 | |
97 | -kind: Service | |
98 | -metadata: | |
99 | - name: zookeeper | |
100 | - namespace: thingsboard | |
101 | -spec: | |
102 | - type: ClusterIP | |
103 | - ports: | |
104 | - - port: 2181 | |
105 | - targetPort: 2181 | |
106 | - name: client | |
107 | - - port: 2888 | |
108 | - targetPort: 2888 | |
109 | - name: server | |
110 | - - port: 3888 | |
111 | - targetPort: 3888 | |
112 | - name: election | |
113 | - selector: | |
114 | - app: zookeeper | |
115 | ---- | |
116 | -apiVersion: apps/v1 | |
117 | -kind: StatefulSet | |
118 | -metadata: | |
119 | - name: tb-kafka | |
120 | - namespace: thingsboard | |
121 | -spec: | |
122 | - serviceName: "tb-kafka" | |
123 | - replicas: 3 | |
124 | - podManagementPolicy: Parallel | |
125 | - selector: | |
126 | - matchLabels: | |
127 | - app: tb-kafka | |
128 | - template: | |
129 | - metadata: | |
130 | - labels: | |
131 | - app: tb-kafka | |
132 | - spec: | |
133 | - containers: | |
134 | - - name: tb-kafka | |
135 | - imagePullPolicy: Always | |
136 | - image: wurstmeister/kafka:2.12-2.2.1 | |
137 | - ports: | |
138 | - - containerPort: 9092 | |
139 | - name: kafka-int | |
140 | - readinessProbe: | |
141 | - periodSeconds: 5 | |
142 | - timeoutSeconds: 5 | |
143 | - tcpSocket: | |
144 | - port: 9092 | |
145 | - initialDelaySeconds: 60 | |
146 | - livenessProbe: | |
147 | - timeoutSeconds: 5 | |
148 | - periodSeconds: 5 | |
149 | - tcpSocket: | |
150 | - port: 9092 | |
151 | - initialDelaySeconds: 80 | |
152 | - env: | |
153 | - - name: BROKER_ID_COMMAND | |
154 | - value: "hostname | cut -d'-' -f3" | |
155 | - - name: KAFKA_ZOOKEEPER_CONNECT | |
156 | - value: "zookeeper:2181" | |
157 | - - name: KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS | |
158 | - value: "60000" | |
159 | - - name: KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE | |
160 | - value: "true" | |
161 | - - name: KAFKA_LISTENERS | |
162 | - value: "INSIDE://:9092" | |
163 | - - name: KAFKA_ADVERTISED_LISTENERS | |
164 | - value: "INSIDE://:9092" | |
165 | - - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP | |
166 | - value: "INSIDE:PLAINTEXT" | |
167 | - - name: KAFKA_INTER_BROKER_LISTENER_NAME | |
168 | - value: "INSIDE" | |
169 | - - name: KAFKA_CONTROLLER_SHUTDOWN_ENABLE | |
170 | - value: "true" | |
171 | - - name: KAFKA_CREATE_TOPICS | |
172 | - value: "js_eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_rule_engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600" | |
173 | - - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE | |
174 | - value: "false" | |
175 | - - name: KAFKA_LOG_RETENTION_BYTES | |
176 | - value: "1073741824" | |
177 | - - name: KAFKA_LOG_SEGMENT_BYTES | |
178 | - value: "268435456" | |
179 | - - name: KAFKA_LOG_RETENTION_MS | |
180 | - value: "300000" | |
181 | - - name: KAFKA_LOG_CLEANUP_POLICY | |
182 | - value: "delete" | |
183 | - - name: KAFKA_PORT | |
184 | - value: "9092" | |
185 | - - name: KAFKA_LOG_DIRS | |
186 | - value: "/kafka-logs" | |
187 | - volumeMounts: | |
188 | - - name: logs | |
189 | - mountPath: /kafka-logs | |
190 | - subPath: logs | |
191 | - volumeClaimTemplates: | |
192 | - - metadata: | |
193 | - name: logs | |
194 | - spec: | |
195 | - accessModes: | |
196 | - - ReadWriteOnce | |
197 | - resources: | |
198 | - requests: | |
199 | - storage: 1Gi | |
200 | ---- | |
201 | -apiVersion: v1 | |
202 | -kind: Service | |
203 | -metadata: | |
204 | - name: tb-kafka | |
205 | - namespace: thingsboard | |
206 | -spec: | |
207 | - type: ClusterIP | |
208 | - ports: | |
209 | - - port: 9092 | |
210 | - targetPort: 9092 | |
211 | - name: kafka-int | |
212 | - selector: | |
213 | - app: tb-kafka | |
214 | ---- | |
215 | -apiVersion: v1 | |
216 | -kind: ConfigMap | |
217 | -metadata: | |
218 | - name: tb-redis | |
219 | - namespace: thingsboard | |
220 | -data: | |
221 | - update-node.sh: | | |
222 | - #!/bin/sh | |
223 | - REDIS_NODES="/data/nodes.conf" | |
224 | - sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" ${REDIS_NODES} | |
225 | - exec "$@" | |
226 | - redis.conf: |+ | |
227 | - cluster-enabled yes | |
228 | - cluster-require-full-coverage no | |
229 | - cluster-node-timeout 15000 | |
230 | - cluster-config-file /data/nodes.conf | |
231 | - cluster-migration-barrier 1 | |
232 | - appendonly yes | |
233 | - protected-mode no | |
234 | ---- | |
235 | -apiVersion: apps/v1 | |
236 | -kind: StatefulSet | |
237 | -metadata: | |
238 | - name: tb-redis | |
239 | - namespace: thingsboard | |
240 | -spec: | |
241 | - serviceName: server | |
242 | - replicas: 6 | |
243 | - selector: | |
244 | - matchLabels: | |
245 | - app: tb-redis | |
246 | - template: | |
247 | - metadata: | |
248 | - labels: | |
249 | - app: tb-redis | |
250 | - spec: | |
251 | - containers: | |
252 | - - name: redis | |
253 | - image: redis:5.0.1-alpine | |
254 | - ports: | |
255 | - - containerPort: 6379 | |
256 | - name: client | |
257 | - - containerPort: 16379 | |
258 | - name: gossip | |
259 | - command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"] | |
260 | - env: | |
261 | - - name: POD_IP | |
262 | - valueFrom: | |
263 | - fieldRef: | |
264 | - fieldPath: status.podIP | |
265 | - volumeMounts: | |
266 | - - name: conf | |
267 | - mountPath: /conf | |
268 | - readOnly: false | |
269 | - - name: data | |
270 | - mountPath: /data | |
271 | - readOnly: false | |
272 | - volumes: | |
273 | - - name: conf | |
274 | - configMap: | |
275 | - name: tb-redis | |
276 | - defaultMode: 0755 | |
277 | - volumeClaimTemplates: | |
278 | - - metadata: | |
279 | - name: data | |
280 | - spec: | |
281 | - accessModes: [ "ReadWriteOnce" ] | |
282 | - resources: | |
283 | - requests: | |
284 | - storage: 100Mi | |
285 | ---- | |
286 | -apiVersion: v1 | |
287 | -kind: Service | |
288 | -metadata: | |
289 | - name: tb-redis | |
290 | - namespace: thingsboard | |
291 | -spec: | |
292 | - type: ClusterIP | |
293 | - ports: | |
294 | - - port: 6379 | |
295 | - targetPort: 6379 | |
296 | - name: client | |
297 | - - port: 16379 | |
298 | - targetPort: 16379 | |
299 | - name: gossip | |
300 | - selector: | |
301 | - app: tb-redis |
k8s/k8s-delete-all.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -kubectl -n thingsboard delete svc,sts,deploy,cm,po,ing --all | |
19 | - | |
20 | -kubectl -n thingsboard get pvc --no-headers=true | awk '//{print $1}' | xargs kubectl -n thingsboard delete --ignore-not-found=true pvc | |
\ No newline at end of file |
k8s/k8s-delete-resources.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -set -e | |
19 | - | |
20 | -source .env | |
21 | - | |
22 | -kubectl config set-context $(kubectl config current-context) --namespace=thingsboard | |
23 | - | |
24 | -kubectl delete -f common/thingsboard.yml | |
25 | -kubectl delete -f common/tb-node.yml |
k8s/k8s-delete-thirdparty.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -set -e | |
19 | - | |
20 | -source .env | |
21 | - | |
22 | -kubectl config set-context $(kubectl config current-context) --namespace=thingsboard | |
23 | -kubectl delete -f $DEPLOYMENT_TYPE/thirdparty.yml |
k8s/k8s-deploy-resources.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -set -e | |
19 | - | |
20 | -source .env | |
21 | - | |
22 | -kubectl apply -f common/tb-namespace.yml | |
23 | -kubectl config set-context $(kubectl config current-context) --namespace=thingsboard | |
24 | -kubectl apply -f common/tb-node-configmap.yml | |
25 | -kubectl apply -f common/tb-mqtt-transport-configmap.yml | |
26 | -kubectl apply -f common/tb-http-transport-configmap.yml | |
27 | -kubectl apply -f common/tb-coap-transport-configmap.yml | |
28 | -kubectl apply -f common/thingsboard.yml | |
29 | -kubectl apply -f $DEPLOYMENT_TYPE/tb-node-cache-configmap.yml | |
30 | -kubectl apply -f common/tb-node.yml |
k8s/k8s-deploy-thirdparty.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -set -e | |
19 | - | |
20 | -source .env | |
21 | - | |
22 | -kubectl apply -f common/tb-namespace.yml | |
23 | -kubectl config set-context $(kubectl config current-context) --namespace=thingsboard | |
24 | - | |
25 | -kubectl apply -f $DEPLOYMENT_TYPE/thirdparty.yml | |
26 | - | |
27 | - | |
28 | -if [ "$DEPLOYMENT_TYPE" == "high-availability" ]; then | |
29 | - echo -n "waiting for all redis pods to be ready"; | |
30 | - while [[ $(kubectl get pods tb-redis-5 -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' 2>/dev/null) != "True" ]]; | |
31 | - do | |
32 | - echo -n "." && sleep 5; | |
33 | - done | |
34 | - | |
35 | - if [[ $(kubectl exec -it tb-redis-0 -- redis-cli cluster info 2>&1 | head -n 1) =~ "cluster_state:ok" ]] | |
36 | - then | |
37 | - echo "redis cluster is already configured" | |
38 | - else | |
39 | - echo "starting redis cluster" | |
40 | - redisNodes=$(kubectl get pods -l app=tb-redis -o jsonpath='{range.items[*]}{.status.podIP}:6379 ') | |
41 | - kubectl exec -it tb-redis-0 -- redis-cli --cluster create --cluster-replicas 1 $redisNodes | |
42 | - fi | |
43 | - | |
44 | -fi | |
45 | - |
k8s/k8s-install-tb.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -function installTb() { | |
19 | - | |
20 | - loadDemo=$1 | |
21 | - | |
22 | - kubectl apply -f common/tb-node-configmap.yml | |
23 | - kubectl apply -f common/database-setup.yml && | |
24 | - kubectl wait --for=condition=Ready pod/tb-db-setup --timeout=120s && | |
25 | - kubectl exec tb-db-setup -- sh -c 'export INSTALL_TB=true; export LOAD_DEMO='"$loadDemo"'; start-tb-node.sh; touch /tmp/install-finished;' | |
26 | - | |
27 | - kubectl delete pod tb-db-setup | |
28 | - | |
29 | -} | |
30 | - | |
31 | -function installPostgres() { | |
32 | - | |
33 | - kubectl apply -f common/postgres.yml | |
34 | - kubectl apply -f common/tb-node-postgres-configmap.yml | |
35 | - | |
36 | - kubectl rollout status deployment/postgres | |
37 | -} | |
38 | - | |
39 | -function installHybrid() { | |
40 | - | |
41 | - kubectl apply -f common/postgres.yml | |
42 | - kubectl apply -f common/cassandra.yml | |
43 | - kubectl apply -f common/tb-node-hybrid-configmap.yml | |
44 | - | |
45 | - kubectl rollout status deployment/postgres | |
46 | - kubectl rollout status statefulset/cassandra | |
47 | - | |
48 | - kubectl exec -it cassandra-0 -- bash -c "cqlsh -e \ | |
49 | - \"CREATE KEYSPACE IF NOT EXISTS thingsboard \ | |
50 | - WITH replication = { \ | |
51 | - 'class' : 'SimpleStrategy', \ | |
52 | - 'replication_factor' : 1 \ | |
53 | - };\"" | |
54 | -} | |
55 | - | |
56 | -while [[ $# -gt 0 ]] | |
57 | -do | |
58 | -key="$1" | |
59 | - | |
60 | -case $key in | |
61 | - --loadDemo) | |
62 | - LOAD_DEMO=true | |
63 | - shift # past argument | |
64 | - ;; | |
65 | - *) | |
66 | - # unknown option | |
67 | - ;; | |
68 | -esac | |
69 | -shift # past argument or value | |
70 | -done | |
71 | - | |
72 | -if [ "$LOAD_DEMO" == "true" ]; then | |
73 | - loadDemo=true | |
74 | -else | |
75 | - loadDemo=false | |
76 | -fi | |
77 | - | |
78 | -source .env | |
79 | - | |
80 | -kubectl apply -f common/tb-namespace.yml | |
81 | -kubectl config set-context $(kubectl config current-context) --namespace=thingsboard | |
82 | - | |
83 | -case $DEPLOYMENT_TYPE in | |
84 | - basic) | |
85 | - ;; | |
86 | - high-availability) | |
87 | - ;; | |
88 | - *) | |
89 | - echo "Unknown DEPLOYMENT_TYPE value specified: '${DEPLOYMENT_TYPE}'. Should be either basic or high-availability." >&2 | |
90 | - exit 1 | |
91 | -esac | |
92 | - | |
93 | -case $DATABASE in | |
94 | - postgres) | |
95 | - installPostgres | |
96 | - installTb ${loadDemo} | |
97 | - ;; | |
98 | - hybrid) | |
99 | - installHybrid | |
100 | - installTb ${loadDemo} | |
101 | - ;; | |
102 | - *) | |
103 | - echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either postgres or hybrid." >&2 | |
104 | - exit 1 | |
105 | -esac | |
106 | - |
k8s/k8s-upgrade-tb.sh
deleted
100755 → 0
1 | -#!/bin/bash | |
2 | -# | |
3 | -# Copyright © 2016-2021 The Thingsboard Authors | |
4 | -# | |
5 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | -# you may not use this file except in compliance with the License. | |
7 | -# You may obtain a copy of the License at | |
8 | -# | |
9 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
10 | -# | |
11 | -# Unless required by applicable law or agreed to in writing, software | |
12 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
13 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | -# See the License for the specific language governing permissions and | |
15 | -# limitations under the License. | |
16 | -# | |
17 | - | |
18 | -for i in "$@" | |
19 | -do | |
20 | -case $i in | |
21 | - --fromVersion=*) | |
22 | - FROM_VERSION="${i#*=}" | |
23 | - shift | |
24 | - ;; | |
25 | - *) | |
26 | - # unknown option | |
27 | - ;; | |
28 | -esac | |
29 | -done | |
30 | - | |
31 | -if [[ -z "${FROM_VERSION// }" ]]; then | |
32 | - echo "--fromVersion parameter is invalid or unspecified!" | |
33 | - echo "Usage: k8s-upgrade-tb.sh --fromVersion={VERSION}" | |
34 | - exit 1 | |
35 | -else | |
36 | - fromVersion="${FROM_VERSION// }" | |
37 | -fi | |
38 | - | |
39 | -kubectl apply -f common/database-setup.yml && | |
40 | -kubectl wait --for=condition=Ready pod/tb-db-setup --timeout=120s && | |
41 | -kubectl exec tb-db-setup -- sh -c 'export UPGRADE_TB=true; export FROM_VERSION='"$fromVersion"'; start-tb-node.sh; touch /tmp/install-finished;' | |
42 | - | |
43 | -kubectl delete pod tb-db-setup |