forked from canonical/iot-devicetwin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-mosquitto.yaml
81 lines (77 loc) · 1.72 KB
/
k8s-mosquitto.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
apiVersion: v1
kind: Secret
metadata:
name: mqtt-certs
data:
# base64 encoded X509 certificate files
ca.crt: LS0tLS1CRUdJTi...WEZuaFUzCmJ3bmZwYzRKNWNHdzg3c3AxSzY3R2Q3VHpFTUJPdXp5alE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server.crt: LS0tLS1CRUdJTi...bUhVPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server.key: LS0tLS1CRUdJTi...FLM3hNbklkWTRuaUtzbFoKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mqtt-config
labels:
app: postgres
data:
iot.conf: |
port 8883
cafile /mosquitto/certs/ca.crt
keyfile /mosquitto/certs/server.key
certfile /mosquitto/certs/server.crt
require_certificate true
use_identity_as_username true
allow_anonymous false
#password_file /mosquitto/passwd_mqtt
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtt
spec:
selector:
matchLabels:
app: mqtt
tier: backend
track: stable
replicas: 1
template:
metadata:
labels:
app: mqtt
tier: backend
track: stable
spec:
containers:
- name: mqtt
image: eclipse-mosquitto
volumeMounts:
- name: config-volume
mountPath: /mosquitto/config
- name: certs
mountPath: /mosquitto/certs
ports:
- containerPort: 8883
volumes:
- name: config-volume
configMap:
name: mqtt-config
items:
- key: iot.conf
path: mosquitto.conf
- name: certs
secret:
secretName: mqtt-certs
---
apiVersion: v1
kind: Service
metadata:
name: mqtt
spec:
selector:
app: mqtt
tier: backend
ports:
- port: 8883
protocol: TCP