-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s.yml
183 lines (183 loc) · 3.81 KB
/
k8s.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
apiVersion: v1
kind: Service
metadata:
labels:
service: api-service
name: api-service
namespace: webpage
spec:
type: ClusterIP
ports:
- name: http
port: 8080
targetPort: 8080
selector:
app: api-service
---
apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
namespace: webpage
data:
config.json: |
{
"openWeatherIconUrl": "https://openweathermap.org/img/wn/{}@2x.png",
"openWeatherUrl": "https://api.openweathermap.org/data/2.5/onecall",
"goodMorningEmails": [
{
"name": "Keith",
"email": "[email protected]",
"timezone": "America/New_York",
"coinbaseSecret": "keith-coinbase",
"location": {
"name": "Philadelphia, PA",
"latitude": 39.9526,
"longitude": -75.1652
}
}
]
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: webpage
labels:
app: api-service
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: api-service
template:
metadata:
labels:
app: api-service
spec:
restartPolicy: Always
imagePullSecrets: []
containers:
- name: api
image: registry.digitalocean.com/keith/api:latest
imagePullPolicy: Always
env:
- name: PORT
value: "8080"
resources:
limits:
cpu: 1100m
ports:
- name: http
containerPort: 8080
readinessProbe:
httpGet:
path: /ping
port: 8080
initialDelaySeconds: 10
periodSeconds: 1
timeoutSeconds: 2
failureThreshold: 100
livenessProbe:
httpGet:
path: /ping
port: 8080
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 10
volumeMounts:
- name: creds
mountPath: /api/creds.json
subPath: creds.json
- name: config-file
mountPath: /api/config.json
subPath: config.json
- name: twittercreds
mountPath: /api/twitter4j.properties
subPath: twitter4j.properties
- name: generic-secrets
mountPath: /api/secrets.json
subPath: secrets.json
volumes:
- name: config-file
configMap:
name: api-config
- name: creds
secret:
secretName: creds
- name: twittercreds
secret:
secretName: twitter-creds
- name: generic-secrets
secret:
secretName: generic-secrets
---
apiVersion: v1
kind: Service
metadata:
labels:
service: db
name: db
namespace: webpage
spec:
type: ClusterIP
ports:
- name: db
port: 27017
targetPort: 27017
selector:
service: db
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: db
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
hostPath:
path: /api/storage
persistentVolumeReclaimPolicy: Retain
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: db
namespace: webpage
spec:
serviceName: db
replicas: 1
selector:
matchLabels:
service: db
template:
metadata:
labels:
service: db
spec:
containers:
- name: mongo
image: mongo:latest
ports:
- name: db
containerPort: 27017
volumeMounts:
- name: db
mountPath: /data/db
volumeClaimTemplates:
- spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
metadata:
name: db
---