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-claim
namespace: thingsboard
labels:
app: postgres
type: local
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/postgres
persistentVolumeReclaimPolicy: Recycle
---
#cassandra
apiVersion: v1
kind: PersistentVolume
metadata:
name: cassandra-data-cassandra-0
labels:
type: local
app: cassandra
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/cassandra-0
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: cassandra-data-cassandra-1
labels:
type: local
app: cassandra
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/cassandra-1
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: cassandra-data-cassandra-2
labels:
type: local
app: cassandra
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/cassandra-2
persistentVolumeReclaimPolicy: 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-0
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/data-0
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zookeeper-datalog-0
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/datalog-0
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zookeeper-data-1
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/data-1
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zookeeper-datalog-1
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/datalog-1
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zookeeper-data-2
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/data-2
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zookeeper-datalog-2
labels:
type: local
app: zookeeper
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/zookeeper/datalog-2
persistentVolumeReclaimPolicy: Recycle
---
#kafka
apiVersion: v1
kind: PersistentVolume
metadata:
name: tb-kafka-logs
labels:
type: local
app: tb-kafka
spec:
capacity:
storage: 200Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-kafka/logs
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: tb-kafka-app-logs
labels:
type: local
app: tb-kafka
spec:
capacity:
storage: 200Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-kafka/app-logs
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: tb-kafka-config
labels:
type: local
app: tb-kafka
spec:
capacity:
storage: 50Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-kafka/config
persistentVolumeReclaimPolicy: 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-0
namespace: thingsboard
labels:
app: tb-node
type: local
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-node/node0
persistentVolumeReclaimPolicy: Recycle
---
#tb-mqtt-transport
apiVersion: v1
kind: PersistentVolume
metadata:
name: tb-mqtt-transport-0
namespace: thingsboard
labels:
app: tb-mqtt-transport
type: local
spec:
capacity:
storage: 200Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-mqtt-transport/transport0
persistentVolumeReclaimPolicy: Recycle
---
#tb-mqtt-transport
apiVersion: v1
kind: PersistentVolume
metadata:
name: tb-mqtt-transport-1
namespace: thingsboard
labels:
app: tb-mqtt-transport
type: local
spec:
capacity:
storage: 200Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/data/tb-mqtt-transport/transport1
persistentVolumeReclaimPolicy: Recycle
---
#tb-coap-transport
apiVersion: v1
kind: