mosquitto.yaml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 true
  106. listener 8883
  107. allow_anonymous false
  108. require_certificate true
  109. use_identity_as_username true
  110. cafile /mosquitto/certs/root.pem
  111. certfile /mosquitto/certs/server.pem
  112. keyfile /mosquitto/certs/server.key
  113. listener 1883
  114. allow_anonymous true
  115. kind: ConfigMap
  116. metadata:
  117. labels:
  118. app.kubernetes.io/instance: mosquitto
  119. app.kubernetes.io/name: mosquitto
  120. name: mosquitto-config
  121. namespace: netmaker
  122. ---
  123. kind: PersistentVolumeClaim
  124. apiVersion: v1
  125. metadata:
  126. name: shared-certs-pvc
  127. spec:
  128. storageClassName: RWX_STORAGE_CLASS
  129. accessModes:
  130. - ReadWriteMany
  131. resources:
  132. requests:
  133. storage: 100Mi
  134. ---
  135. apiVersion: v1
  136. kind: Service
  137. metadata:
  138. labels:
  139. name: 'netmaker-mqtt'
  140. spec:
  141. externalTrafficPolicy: Cluster
  142. type: NodePort
  143. selector:
  144. app.kubernetes.io/instance: mosquitto
  145. app.kubernetes.io/name: mosquitto
  146. ports:
  147. - port: 31883
  148. nodePort: 31883
  149. protocol: TCP
  150. targetPort: 8883
  151. name: nm-mqtt