mosquitto.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. ---
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: mosquitto
  6. spec:
  7. progressDeadlineSeconds: 600
  8. replicas: 1
  9. selector:
  10. matchLabels:
  11. app.kubernetes.io/instance: mosquitto
  12. app.kubernetes.io/name: mosquitto
  13. strategy:
  14. type: Recreate
  15. template:
  16. metadata:
  17. labels:
  18. app.kubernetes.io/instance: mosquitto
  19. app.kubernetes.io/name: mosquitto
  20. spec:
  21. affinity:
  22. nodeAffinity:
  23. requiredDuringSchedulingIgnoredDuringExecution:
  24. nodeSelectorTerms:
  25. - matchExpressions:
  26. - key: mqhost
  27. operator: In
  28. values:
  29. - "true"
  30. containers:
  31. - image: eclipse-mosquitto:2.0.11-openssl
  32. imagePullPolicy: IfNotPresent
  33. livenessProbe:
  34. failureThreshold: 3
  35. periodSeconds: 10
  36. successThreshold: 1
  37. tcpSocket:
  38. port: 8883
  39. timeoutSeconds: 1
  40. name: mosquitto
  41. ports:
  42. - containerPort: 1883
  43. name: mqtt
  44. protocol: TCP
  45. - containerPort: 8883
  46. name: mqtt2
  47. protocol: TCP
  48. readinessProbe:
  49. failureThreshold: 3
  50. periodSeconds: 10
  51. successThreshold: 1
  52. tcpSocket:
  53. port: 8883
  54. timeoutSeconds: 1
  55. resources: {}
  56. startupProbe:
  57. failureThreshold: 30
  58. periodSeconds: 5
  59. successThreshold: 1
  60. tcpSocket:
  61. port: 8883
  62. timeoutSeconds: 1
  63. terminationMessagePath: /dev/termination-log
  64. terminationMessagePolicy: File
  65. volumeMounts:
  66. - mountPath: /mosquitto/config/mosquitto.conf
  67. name: mosquitto-config
  68. subPath: mosquitto.conf
  69. - mountPath: /mosquitto/certs
  70. name: shared-certs
  71. dnsPolicy: ClusterFirst
  72. restartPolicy: Always
  73. terminationGracePeriodSeconds: 30
  74. volumes:
  75. - configMap:
  76. name: mosquitto-config
  77. name: mosquitto-config
  78. - name: shared-certs
  79. persistentVolumeClaim:
  80. claimName: shared-certs-pvc
  81. ---
  82. apiVersion: v1
  83. kind: Service
  84. metadata:
  85. name: mq
  86. namespace: netmaker
  87. spec:
  88. ports:
  89. - name: mqtt
  90. port: 1883
  91. protocol: TCP
  92. targetPort: mqtt
  93. - name: mqtt2
  94. port: 8883
  95. protocol: TCP
  96. targetPort: mqtt2
  97. selector:
  98. app.kubernetes.io/instance: mosquitto
  99. app.kubernetes.io/name: mosquitto
  100. sessionAffinity: None
  101. ---
  102. apiVersion: v1
  103. data:
  104. mosquitto.conf: |
  105. per_listener_settings false
  106. listener 8883
  107. protocol websockets
  108. allow_anonymous false
  109. listener 1883
  110. protocol websockets
  111. allow_anonymous false
  112. plugin /usr/lib/mosquitto_dynamic_security.so
  113. plugin_opt_config_file /mosquitto/data/dynamic-security.json
  114. kind: ConfigMap
  115. metadata:
  116. labels:
  117. app.kubernetes.io/instance: mosquitto
  118. app.kubernetes.io/name: mosquitto
  119. name: mosquitto-config
  120. namespace: netmaker
  121. ---
  122. kind: PersistentVolumeClaim
  123. apiVersion: v1
  124. metadata:
  125. name: shared-certs-pvc
  126. spec:
  127. storageClassName: RWX_STORAGE_CLASS
  128. accessModes:
  129. - ReadWriteMany
  130. resources:
  131. requests:
  132. storage: 100Mi
  133. ---
  134. apiVersion: v1
  135. kind: Service
  136. metadata:
  137. labels:
  138. name: 'netmaker-mqtt'
  139. spec:
  140. externalTrafficPolicy: Cluster
  141. type: NodePort
  142. selector:
  143. app.kubernetes.io/instance: mosquitto
  144. app.kubernetes.io/name: mosquitto
  145. ports:
  146. - port: 31883
  147. nodePort: 31883
  148. protocol: TCP
  149. targetPort: 8883
  150. name: nm-mqtt
  151. # ---
  152. # apiVersion: networking.k8s.io/v1
  153. # kind: Ingress
  154. # metadata:
  155. # name: nm-mqtt-ingress-nginx
  156. # annotations:
  157. # nginx.ingress.kubernetes.io/rewrite-target: /
  158. # cert-manager.io/cluster-issuer: "letsencrypt-nginx"
  159. # nginx.ingress.kubernetes.io/ssl-redirect: 'true'
  160. # spec:
  161. # ingressClassName: nginx
  162. # tls:
  163. # - hosts:
  164. # - broker.NETMAKER_SUBDOMAIN
  165. # secretName: nm-mqtt-tls
  166. # rules:
  167. # - host: broker.NETMAKER_SUBDOMAIN
  168. # http:
  169. # paths:
  170. # - path: /
  171. # pathType: Prefix
  172. # backend:
  173. # service:
  174. # name: netmaker-mqtt
  175. # port:
  176. # number: 8883