forked from canonical/iot-devicetwin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-devicetwin.yaml
105 lines (105 loc) · 2.34 KB
/
k8s-devicetwin.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
apiVersion: v1
kind: Secret
metadata:
name: devicetwin-certs
data:
# base64 encoded X509 certificate files
ca.crt: LS0tLS1CRUdJTi...WEZuaFUzCmJ3bmZwYzRKNWNHdzg3c3AxSzY3R2Q3VHpFTUJPdXp5alE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server.crt: LS0tLS1CRUdJTi...bUhVPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server.key: LS0tLS1CRUdJTi...FLM3hNbklkWTRuaUtzbFoKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: devicetwin-pv-volume-twin
labels:
type: local
app: devicetwin
spec:
storageClassName: manual
capacity:
storage: 0.5Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: devicetwin-pv-claim-twin
labels:
app: devicetwin
spec:
#storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 0.5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: devicetwin
spec:
selector:
matchLabels:
app: devicetwin
tier: frontend
track: stable
replicas: 1
template:
metadata:
labels:
app: devicetwin
tier: frontend
track: stable
spec:
containers:
- name: devicetwin
image: sonicblue/iot-devicetwin
volumeMounts:
- name: certs
mountPath: /srv/certs
- name: config
mountPath: /srv/config
env:
- name: PORT
value: "8040"
- name: DRIVER
value: "postgres"
- name: DATASOURCE
valueFrom:
configMapKeyRef:
name: postgres-config-twin
key: DATASOURCE
- name: MQTTURL
value: "mqtt"
- name: MQTTPORT
value: "8883"
- name: CERTSDIR
value: "/srv/certs"
- name: CONFIGDIR
value: "/srv/config"
ports:
- containerPort: 8040
volumes:
- name: certs
secret:
secretName: devicetwin-certs
- name: config
persistentVolumeClaim:
claimName: devicetwin-pv-claim-twin
---
apiVersion: v1
kind: Service
metadata:
name: devicetwin
spec:
selector:
app: devicetwin
tier: frontend
ports:
- port: 8040
protocol: TCP