-
Notifications
You must be signed in to change notification settings - Fork 0
/
mqtt.yaml
114 lines (111 loc) · 2.54 KB
/
mqtt.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mosquitto-data
namespace: {{namespace}}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: microk8s-hostpath
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mosquitto-config
namespace: {{namespace}}
annotations:
reloader.stakater.com/auto: "true"
labels:
app.kubernetes.io/name: mosquitto
data:
mosquitto.conf: |
listener {{mqtt_port}}
allow_anonymous true
persistence true
persistence_location /mosquitto/data
autosave_interval 1800
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtt
namespace: {{namespace}}
labels:
app.kubernetes.io/name: mosquitto
spec:
revisionHistoryLimit: 3
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: mosquitto
template:
metadata:
labels:
app.kubernetes.io/name: mosquitto
spec:
containers:
- name: mosquitto
image: "eclipse-mosquitto:2.0.14"
imagePullPolicy: IfNotPresent
ports:
- name: mqtt
containerPort: {{mqtt_port}}
protocol: TCP
volumeMounts:
- name: data
mountPath: /mosquitto/data
- name: mosquitto-config
mountPath: /mosquitto/config/mosquitto.conf
subPath: mosquitto.conf
livenessProbe:
tcpSocket:
port: {{mqtt_port}}
initialDelaySeconds: 0
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 60
readinessProbe:
tcpSocket:
port: {{mqtt_port}}
initialDelaySeconds: 0
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 60
startupProbe:
tcpSocket:
port: {{mqtt_port}}
initialDelaySeconds: 0
failureThreshold: 30
timeoutSeconds: 1
periodSeconds: 5
volumes:
- name: data
persistentVolumeClaim:
claimName: mosquitto-data
- name: mosquitto-config
configMap:
name: mosquitto-config
---
apiVersion: v1
kind: Service
metadata:
name: mqtt
namespace: {{namespace}}
labels:
app.kubernetes.io/name: mosquitto
spec:
type: LoadBalancer
loadBalancerIP: 192.168.181.81
ports:
- name: mqtt
port: {{mqtt_port}}
protocol: TCP
targetPort: {{mqtt_port}}
selector:
app.kubernetes.io/name: mosquitto