-
Notifications
You must be signed in to change notification settings - Fork 1
/
rocketchat.yaml
191 lines (191 loc) · 4.36 KB
/
rocketchat.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
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
184
185
186
187
188
189
190
191
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rocket-chat-db-view
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: rocket-chat-db-view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: rocket-chat-db-view
namespace: default
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rocket-chat-db
labels:
app: rocket-chat-db
spec:
serviceName: rocket-chat-db
replicas: 3
selector:
matchLabels:
app: rocket-chat-db
template:
metadata:
labels:
app: rocket-chat-db
spec:
serviceAccountName: rocket-chat-db-view
securityContext:
fsGroup: 1000
runAsUser: 1000
containers:
- name: rocket-chat-db
image: mongo:4.0
env:
- name: MONGO_INITDB_DATABASE
value: rocket-chat
command:
- mongod
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
- "--bind_ip_all"
resources:
limits: { memory: "1Gi", cpu: "500m" }
ports:
- containerPort: 27017
volumeMounts:
- name: rocket-chat-db-data-pvc
mountPath: /data/db
readinessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
timeoutSeconds: 5
- name: mongo-sidecar
image: cvallance/mongo-k8s-sidecar
env:
- name: MONGO_SIDECAR_POD_LABELS
value: "app=rocket-chat-db"
volumeClaimTemplates:
- metadata:
name: rocket-chat-db-data-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rocket-chat
labels:
app: rocket-chat
spec:
replicas: 3
selector:
matchLabels:
app: rocket-chat
template:
metadata:
labels:
app: rocket-chat
spec:
initContainers:
- name: init-volume
image: busybox
command:
- 'sh'
- '-c'
- 'chown -R 999:999 /uploads'
volumeMounts:
- name: rocket-chat-uploads
mountPath: /uploads
containers:
- name: rocket-chat
image: rocket.chat:3.9
env:
- name: MONGO_URL
value: mongodb://rocket-chat-db-0.rocket-chat-db,rocket-chat-db-1.rocket-chat-db,rocket-chat-db-2.rocket-chat-db:27017/rocket-chat?replicaSet=rs0
- name: MONGO_OPLOG_URL
value: mongodb://rocket-chat-db-0.rocket-chat-db,rocket-chat-db-1.rocket-chat-db,rocket-chat-db-2.rocket-chat-db:27017/local?replicaSet=rs0
- name: ROOT_URL
value: http://rocket-chat.kubed
- name: PORT
value: "3000"
resources:
requests: { memory: "500Mi", cpu: "200m" }
limits: { memory: "1Gi", cpu: "400m" }
ports:
- containerPort: 3000
volumeMounts:
- name: rocket-chat-uploads
mountPath: /app/uploads
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 15
volumes:
- name: rocket-chat-uploads
persistentVolumeClaim:
claimName: rocket-chat-uploads-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rocket-chat-uploads-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: rocket-chat-svc
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 3000
targetPort: 3000
selector:
app: rocket-chat
---
apiVersion: v1
kind: Service
metadata:
name: rocket-chat-db
spec:
selector:
app: rocket-chat-db
# clusterIP: None
ports:
- port: 27017
targetPort: 27017
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: rocket-chat-ingress
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: rocket-chat.kubed
http:
paths:
- path: /
backend:
serviceName: rocket-chat-svc
servicePort: 3000