Merge pull request #351 from galal-hussein/mongo-fix

Fix MongoDB replicaset template for Kubernetes
This commit is contained in:
Raúl Sánchez 2017-07-04 11:59:23 +02:00 committed by GitHub
commit 7446304f8e
3 changed files with 56 additions and 16 deletions

View File

@ -9,23 +9,42 @@ spec:
template:
spec:
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
image: husseingalal/mongo-k8s
image: mongo:3.4
ports:
- containerPort: 27017
volumeMounts:
- name: mongo-ephermal-storage
- name: mongo-datadir
mountPath: /data/db
- mountPath: /opt/rancher/bin
name: utility
command:
- /run.sh
- /opt/rancher/bin/run.sh
- mongod
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
env:
- name: PRIMARY
value: "false"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumes:
- name: mongo-ephermal-storage
emptyDir: {}
- name: mongo-datadir
hostPath:
path: ${mongo_volume}
- name: utility
emptyDir: {}
metadata:
labels:
secondary: "true"

View File

@ -9,33 +9,49 @@ spec:
- port: 27017
targetPort: 27017
selector:
name: mongo-master
name: mongo-primary
---
apiVersion: v1
kind: Pod
metadata:
labels:
name: mongo-master
name: mongo-master
name: mongo-primary
name: mongo-primary
spec:
containers:
- name: mongo-master
image: "husseingalal/mongo-k8s"
- name: mongo-config
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:
- name: PRIMARY
value: "true"
- name: PRIMARY
value: "true"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- containerPort: 27017
command:
- /run.sh
- /opt/rancher/bin/run.sh
- mongod
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
volumeMounts:
- mountPath: /opt/rancher/bin
name: utility
- mountPath: /data/db
name: mongo-primary-ephermal-storage
name: mongo-datadir
volumes:
- name: mongo-primary-ephermal-storage
emptyDir: {}
- name: mongo-datadir
hostPath:
path: ${mongo_volume}
- name: utility
emptyDir: {}

View File

@ -10,3 +10,8 @@
type: int
default: 2
description: "should be even number"
- variable: "mongo_volume"
label: "hostpath volume for mongodb"
required: true
type: string
default: "/data/db"