1、从 docker hub 拉取 ThingsBoard PE 映像(所有节点)
1.1、查看k8s信息(主节点)
kubectl cluster-info #查看k8s集群信息
kubectl get node #查看节点信息
kubectl get pod -A #查看内部组件
1.2、从 docker hub 拉取 ThingsBoard PE 映像(所有节点)
- 运行以下命令从 Docker 中心拉取映像。
docker pull thingsboard/tb-pe-node:3.6.3PE
docker pull thingsboard/tb-pe-web-report:3.6.3PE
docker pull thingsboard/tb-pe-web-ui:3.6.3PE
docker pull thingsboard/tb-pe-js-executor:3.6.3PE
docker pull thingsboard/tb-pe-http-transport:3.6.3PE
docker pull thingsboard/tb-pe-mqtt-transport:3.6.3PE
docker pull thingsboard/tb-pe-coap-transport:3.6.3PE
docker pull thingsboard/tb-pe-lwm2m-transport:3.6.3PE
docker pull thingsboard/tb-pe-snmp-transport:3.6.3PE
2、创建K8S集群PV存储库(主节点)
2.1、创建数据资源PV存储库:thingsboard-db-pv.yml
vi thingsboard-db-pv.yml
复制添加以下内容到thingsboard-db-pv.yml文件中:
#postgres
apiVersion: v1
kind: PersistentVolume
metadata:name: postgres-pv-claimnamespace: thingsboardlabels:app: postgrestype: local
spec:capacity:storage: 5GiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/postgrespersistentVolumeReclaimPolicy: Recycle
---
#cassandra
apiVersion: v1
kind: PersistentVolume
metadata:name: cassandra-data-cassandra-0labels:type: localapp: cassandra
spec:capacity:storage: 8GiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/cassandra-0persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: cassandra-data-cassandra-1labels:type: localapp: cassandra
spec:capacity:storage: 8GiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/cassandra-1persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: cassandra-data-cassandra-2labels:type: localapp: cassandra
spec:capacity:storage: 8GiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/cassandra-2persistentVolumeReclaimPolicy: Recycle
创建目录:
mkdir -p /tmp/data/postgres
mkdir -p /tmp/data/cassandra-0
mkdir -p /tmp/data/cassandra-1
mkdir -p /tmp/data/cassandra-2
2.2、创建第三方资源PV存储库:thingsboard-third-pv.yml
vi thingsboard-third-pv.yml
复制添加以下内容到thingsboard-third-pv.yml文件中:
#zookeeper
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-data-0labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/data-0persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-datalog-0labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/datalog-0persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-data-1labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/data-1persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-datalog-1labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/datalog-1persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-data-2labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/data-2persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: zookeeper-datalog-2labels:type: localapp: zookeeper
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/zookeeper/datalog-2persistentVolumeReclaimPolicy: Recycle
---
#kafka
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-kafka-logslabels:type: localapp: tb-kafka
spec:capacity:storage: 200MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-kafka/logspersistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-kafka-app-logslabels:type: localapp: tb-kafka
spec:capacity:storage: 200MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-kafka/app-logspersistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-kafka-configlabels:type: localapp: tb-kafka
spec:capacity:storage: 50MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-kafka/configpersistentVolumeReclaimPolicy: Recycle
创建目录:
mkdir -p /tmp/data/zookeeper/data-0
mkdir -p /tmp/data/zookeeper/datalog-0
mkdir -p /tmp/data/zookeeper/data-1
mkdir -p /tmp/data/zookeeper/datalog-1
mkdir -p /tmp/data/zookeeper/data-2
mkdir -p /tmp/data/zookeeper/datalog-2
mkdir -p /tmp/data/tb-kafka/logs
mkdir -p /tmp/data/tb-kafka/app-logs
mkdir -p /tmp/data/tb-kafka/config
2.3、创建tb资源PV存储库:thingsboard-tb-pv.yml
- 复制添加以下内容到thingsboard-tb-pv.yml文件中:
#tb-node
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-node-0namespace: thingsboardlabels:app: tb-nodetype: local
spec:capacity:storage: 100MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-node/node0persistentVolumeReclaimPolicy: Recycle
---
#tb-mqtt-transport
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-mqtt-transport-0namespace: thingsboardlabels:app: tb-mqtt-transporttype: local
spec:capacity:storage: 200MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-mqtt-transport/transport0persistentVolumeReclaimPolicy: Recycle
---
#tb-mqtt-transport
apiVersion: v1
kind: PersistentVolume
metadata:name: tb-mqtt-transport-1namespace: thingsboardlabels:app: tb-mqtt-transporttype: local
spec:capacity:storage: 200MiaccessModes:- ReadWriteOncehostPath:path: /tmp/data/tb-mqtt-transport/transport1persistentVolumeReclaimPolicy: Recycle
---
#tb-coap-transport
apiVersion: v1
kind: