• 六、从零实战企业级K8S本地部署ThingsBoard专业版集群


    1、从 docker hub 拉取 ThingsBoard PE 映像(所有节点)

    1.1、查看k8s信息(主节点)

    1. kubectl cluster-info #查看k8s集群信息
    2. kubectl get node #查看节点信息
    3. kubectl get pod -A #查看内部组件

    1.2、从 docker hub 拉取 ThingsBoard PE 映像(所有节点)

    • 运行以下命令从 Docker 中心拉取映像。
    1. docker pull thingsboard/tb-pe-node:3.6.3PE
    2. docker pull thingsboard/tb-pe-web-report:3.6.3PE
    3. docker pull thingsboard/tb-pe-web-ui:3.6.3PE
    4. docker pull thingsboard/tb-pe-js-executor:3.6.3PE
    5. docker pull thingsboard/tb-pe-http-transport:3.6.3PE
    6. docker pull thingsboard/tb-pe-mqtt-transport:3.6.3PE
    7. docker pull thingsboard/tb-pe-coap-transport:3.6.3PE
    8. docker pull thingsboard/tb-pe-lwm2m-transport:3.6.3PE
    9. 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文件中

    1. #postgres
    2. apiVersion: v1
    3. kind: PersistentVolume
    4. metadata:
    5. name: postgres-pv-claim
    6. namespace: thingsboard
    7. labels:
    8. app: postgres
    9. type: local
    10. spec:
    11. capacity:
    12. storage: 5Gi
    13. accessModes:
    14. - ReadWriteOnce
    15. hostPath:
    16. path: /tmp/data/postgres
    17. persistentVolumeReclaimPolicy: Recycle
    18. ---
    19. #cassandra
    20. apiVersion: v1
    21. kind: PersistentVolume
    22. metadata:
    23. name: cassandra-data-cassandra-0
    24. labels:
    25. type: local
    26. app: cassandra
    27. spec:
    28. capacity:
    29. storage: 8Gi
    30. accessModes:
    31. - ReadWriteOnce
    32. hostPath:
    33. path: /tmp/data/cassandra-0
    34. persistentVolumeReclaimPolicy: Recycle
    35. ---
    36. apiVersion: v1
    37. kind: PersistentVolume
    38. metadata:
    39. name: cassandra-data-cassandra-1
    40. labels:
    41. type: local
    42. app: cassandra
    43. spec:
    44. capacity:
    45. storage: 8Gi
    46. accessModes:
    47. - ReadWriteOnce
    48. hostPath:
    49. path: /tmp/data/cassandra-1
    50. persistentVolumeReclaimPolicy: Recycle
    51. ---
    52. apiVersion: v1
    53. kind: PersistentVolume
    54. metadata:
    55. name: cassandra-data-cassandra-2
    56. labels:
    57. type: local
    58. app: cassandra
    59. spec:
    60. capacity:
    61. storage: 8Gi
    62. accessModes:
    63. - ReadWriteOnce
    64. hostPath:
    65. path: /tmp/data/cassandra-2
    66. persistentVolumeReclaimPolicy: Recycle

    创建目录

    1. mkdir -p /tmp/data/postgres
    2. mkdir -p /tmp/data/cassandra-0
    3. mkdir -p /tmp/data/cassandra-1
    4. mkdir -p /tmp/data/cassandra-2

    2.2、创建第三方资源PV存储库:thingsboard-third-pv.yml

    vi thingsboard-third-pv.yml

    复制添加以下内容到thingsboard-third-pv.yml文件中

    1. #zookeeper
    2. apiVersion: v1
    3. kind: PersistentVolume
    4. metadata:
    5. name: zookeeper-data-0
    6. labels:
    7. type: local
    8. app: zookeeper
    9. spec:
    10. capacity:
    11. storage: 100Mi
    12. accessModes:
    13. - ReadWriteOnce
    14. hostPath:
    15. path: /tmp/data/zookeeper/data-0
    16. persistentVolumeReclaimPolicy: Recycle
    17. ---
    18. apiVersion: v1
    19. kind: PersistentVolume
    20. metadata:
    21. name: zookeeper-datalog-0
    22. labels:
    23. type: local
    24. app: zookeeper
    25. spec:
    26. capacity:
    27. storage: 100Mi
    28. accessModes:
    29. - ReadWriteOnce
    30. hostPath:
    31. path: /tmp/data/zookeeper/datalog-0
    32. persistentVolumeReclaimPolicy: Recycle
    33. ---
    34. apiVersion: v1
    35. kind: PersistentVolume
    36. metadata:
    37. name: zookeeper-data-1
    38. labels:
    39. type: local
    40. app: zookeeper
    41. spec:
    42. capacity:
    43. storage: 100Mi
    44. accessModes:
    45. - ReadWriteOnce
    46. hostPath:
    47. path: /tmp/data/zookeeper/data-1
    48. persistentVolumeReclaimPolicy: Recycle
    49. ---
    50. apiVersion: v1
    51. kind: PersistentVolume
    52. metadata:
    53. name: zookeeper-datalog-1
    54. labels:
    55. type: local
    56. app: zookeeper
    57. spec:
    58. capacity:
    59. storage: 100Mi
    60. accessModes:
    61. - ReadWriteOnce
    62. hostPath:
    63. path: /tmp/data/zookeeper/datalog-1
    64. persistentVolumeReclaimPolicy: Recycle
    65. ---
    66. apiVersion: v1
    67. kind: PersistentVolume
    68. metadata:
    69. name: zookeeper-data-2
    70. labels:
    71. type: local
    72. app: zookeeper
    73. spec:
    74. capacity:
    75. storage: 100Mi
    76. accessModes:
    77. - ReadWriteOnce
    78. hostPath:
    79. path: /tmp/data/zookeeper/data-2
    80. persistentVolumeReclaimPolicy: Recycle
    81. ---
    82. apiVersion: v1
    83. kind: PersistentVolume
    84. metadata:
    85. name: zookeeper-datalog-2
    86. labels:
    87. type: local
    88. app: zookeeper
    89. spec:
    90. capacity:
    91. storage: 100Mi
    92. accessModes:
    93. - ReadWriteOnce
    94. hostPath:
    95. path: /tmp/data/zookeeper/datalog-2
    96. persistentVolumeReclaimPolicy: Recycle
    97. ---
    98. #kafka
    99. apiVersion: v1
    100. kind: PersistentVolume
    101. metadata:
    102. name: tb-kafka-logs
    103. labels:
    104. type: local
    105. app: tb-kafka
    106. spec:
    107. capacity:
    108. storage: 200Mi
    109. accessModes:
    110. - ReadWriteOnce
    111. hostPath:
    112. path: /tmp/data/tb-kafka/logs
    113. persistentVolumeReclaimPolicy: Recycle
    114. ---
    115. apiVersion: v1
    116. kind: PersistentVolume
    117. metadata:
    118. name: tb-kafka-app-logs
    119. labels:
    120. type: local
    121. app: tb-kafka
    122. spec:
    123. capacity:
    124. storage: 200Mi
    125. accessModes:
    126. - ReadWriteOnce
    127. hostPath:
    128. path: /tmp/data/tb-kafka/app-logs
    129. persistentVolumeReclaimPolicy: Recycle
    130. ---
    131. apiVersion: v1
    132. kind: PersistentVolume
    133. metadata:
    134. name: tb-kafka-config
    135. labels:
    136. type: local
    137. app: tb-kafka
    138. spec:
    139. capacity:
    140. storage: 50Mi
    141. accessModes:
    142. - ReadWriteOnce
    143. hostPath:
    144. path: /tmp/data/tb-kafka/config
    145. persistentVolumeReclaimPolicy: Recycle

    创建目录:

    1. mkdir -p /tmp/data/zookeeper/data-0
    2. mkdir -p /tmp/data/zookeeper/datalog-0
    3. mkdir -p /tmp/data/zookeeper/data-1
    4. mkdir -p /tmp/data/zookeeper/datalog-1
    5. mkdir -p /tmp/data/zookeeper/data-2
    6. mkdir -p /tmp/data/zookeeper/datalog-2
    7. mkdir -p /tmp/data/tb-kafka/logs
    8. mkdir -p /tmp/data/tb-kafka/app-logs
    9. mkdir -p /tmp/data/tb-kafka/config

    2.3、创建tb资源PV存储库:thingsboard-tb-pv.yml

    • 复制添加以下内容到thingsboard-tb-pv.yml文件中
    1. #tb-node
    2. apiVersion: v1
    3. kind: PersistentVolume
    4. metadata:
    5. name: tb-node-0
    6. namespace: thingsboard
    7. labels:
    8. app: tb-node
    9. type: local
    10. spec:
    11. capacity:
    12. storage: 100Mi
    13. accessModes:
    14. - ReadWriteOnce
    15. hostPath:
    16. path: /tmp/data/tb-node/node0
    17. persistentVolumeReclaimPolicy: Recycle
    18. ---
    19. #tb-mqtt-transport
    20. apiVersion: v1
    21. kind: PersistentVolume
    22. metadata:
    23. name: tb-mqtt-transport-0
    24. namespace: thingsboard
    25. labels:
    26. app: tb-mqtt-transport
    27. type: local
    28. spec:
    29. capacity:
    30. storage: 200Mi
    31. accessModes:
    32. - ReadWriteOnce
    33. hostPath:
    34. path: /tmp/data/tb-mqtt-transport/transport0
    35. persistentVolumeReclaimPolicy: Recycle
    36. ---
    37. #tb-mqtt-transport
    38. apiVersion: v1
    39. kind: PersistentVolume
    40. metadata:
    41. name: tb-mqtt-transport-1
    42. namespace: thingsboard
    43. labels:
    44. app: tb-mqtt-transport
    45. type: local
    46. spec:
    47. capacity:
    48. storage: 200Mi
    49. accessModes:
    50. - ReadWriteOnce
    51. hostPath:
    52. path: /tmp/data/tb-mqtt-transport/transport1
    53. persistentVolumeReclaimPolicy: Recycle
    54. ---
    55. #tb-coap-transport
    56. apiVersion: v1
    57. kind:
  • 相关阅读:
    元气森林推“有矿”,农夫山泉们跟着“卷”?
    SpringBoot项目整合Redis,Rabbitmq发送、消费、存储邮件
    oracle rman restore database的时候报错RMAN-06023: 没有找到数据文件1的副本来还原
    SpringBoot自动装配原理
    JavaScript 62 JavaScript 版本 62.4 ECMAScript 2016
    【Spring框架】——4.依赖注入(DI)
    Django基础二静态文件和ORM
    网页大作业代码自取
    金九银十拿下字节,阿里等3家offer,全靠P9架构师整理的这份1658页Java面试核心讲(进阶版)
    基于Java毕业设计银枫家政服务管理系统源码+系统+mysql+lw文档+部署软件
  • 原文地址:https://blog.csdn.net/weixin_67440240/article/details/136656441