-
Notifications
You must be signed in to change notification settings - Fork 8
/
mongodb-master.yaml
52 lines (52 loc) · 1.37 KB
/
mongodb-master.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
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mongo-mongodb
namespace: kube-system
spec:
serviceName: "mongo-mongodb"
replicas: 1
template:
metadata:
labels:
role: mongo-mongodb
mongodb: "true"
spec:
terminationGracePeriodSeconds: 20
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- node1
- node2
- master1
- master2
- master3
containers:
- name: mongo-mongodb
image: mongo:3
imagePullPolicy: IfNotPresent
env:
- name: TZ
value: "Asia/Shanghai"
ports:
- containerPort: 27017
name: dbport
volumeMounts:
- name: mongodb-persistent-storage
mountPath: /data/db
subPath: mongodb
volumeClaimTemplates:
- metadata:
name: mongodb-persistent-storage
annotations:
volume.beta.kubernetes.io/storage-class: "fast"
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi