Merge pull request #351 from galal-hussein/mongo-fix
Fix MongoDB replicaset template for Kubernetes
This commit is contained in:
commit
7446304f8e
@ -9,23 +9,42 @@ spec:
|
|||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
|
- image: husseingalal/mongo-k8s-config:v0.2.0
|
||||||
|
name: mongo-config
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /opt/rancher/bin
|
||||||
|
name: utility
|
||||||
|
stdin: true
|
||||||
|
tty: true
|
||||||
- name: mongo-sec
|
- name: mongo-sec
|
||||||
image: husseingalal/mongo-k8s
|
image: mongo:3.4
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 27017
|
- containerPort: 27017
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: mongo-ephermal-storage
|
- name: mongo-datadir
|
||||||
mountPath: /data/db
|
mountPath: /data/db
|
||||||
|
- mountPath: /opt/rancher/bin
|
||||||
|
name: utility
|
||||||
command:
|
command:
|
||||||
- /run.sh
|
- /opt/rancher/bin/run.sh
|
||||||
- mongod
|
- mongod
|
||||||
- "--replSet"
|
- "--replSet"
|
||||||
- rs0
|
- rs0
|
||||||
- "--smallfiles"
|
- "--smallfiles"
|
||||||
- "--noprealloc"
|
- "--noprealloc"
|
||||||
|
env:
|
||||||
|
- name: PRIMARY
|
||||||
|
value: "false"
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
volumes:
|
volumes:
|
||||||
- name: mongo-ephermal-storage
|
- name: mongo-datadir
|
||||||
emptyDir: {}
|
hostPath:
|
||||||
|
path: ${mongo_volume}
|
||||||
|
- name: utility
|
||||||
|
emptyDir: {}
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
secondary: "true"
|
secondary: "true"
|
||||||
|
@ -9,33 +9,49 @@ spec:
|
|||||||
- port: 27017
|
- port: 27017
|
||||||
targetPort: 27017
|
targetPort: 27017
|
||||||
selector:
|
selector:
|
||||||
name: mongo-master
|
name: mongo-primary
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
name: mongo-master
|
name: mongo-primary
|
||||||
name: mongo-master
|
name: mongo-primary
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: mongo-master
|
- name: mongo-config
|
||||||
image: "husseingalal/mongo-k8s"
|
image: husseingalal/mongo-k8s-config:v0.2.0
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /opt/rancher/bin
|
||||||
|
name: utility
|
||||||
|
stdin: true
|
||||||
|
tty: true
|
||||||
|
- name: mongo-primary
|
||||||
|
image: mongo:3.4
|
||||||
env:
|
env:
|
||||||
- name: PRIMARY
|
- name: PRIMARY
|
||||||
value: "true"
|
value: "true"
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 27017
|
- containerPort: 27017
|
||||||
command:
|
command:
|
||||||
- /run.sh
|
- /opt/rancher/bin/run.sh
|
||||||
- mongod
|
- mongod
|
||||||
- "--replSet"
|
- "--replSet"
|
||||||
- rs0
|
- rs0
|
||||||
- "--smallfiles"
|
- "--smallfiles"
|
||||||
- "--noprealloc"
|
- "--noprealloc"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
- mountPath: /opt/rancher/bin
|
||||||
|
name: utility
|
||||||
- mountPath: /data/db
|
- mountPath: /data/db
|
||||||
name: mongo-primary-ephermal-storage
|
name: mongo-datadir
|
||||||
volumes:
|
volumes:
|
||||||
- name: mongo-primary-ephermal-storage
|
- name: mongo-datadir
|
||||||
emptyDir: {}
|
hostPath:
|
||||||
|
path: ${mongo_volume}
|
||||||
|
- name: utility
|
||||||
|
emptyDir: {}
|
||||||
|
@ -10,3 +10,8 @@
|
|||||||
type: int
|
type: int
|
||||||
default: 2
|
default: 2
|
||||||
description: "should be even number"
|
description: "should be even number"
|
||||||
|
- variable: "mongo_volume"
|
||||||
|
label: "hostpath volume for mongodb"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "/data/db"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user