bigchaindb/k8s/mongodb/mongo-ss.yaml
Krish ea6ce5c1a1 Single node/cluster bootstrap and node addition workflow in k8s (#1278)
* Combining configs
*  Combining the persistent volume claims into a single file.
*  Combining the storage classes into a single file.

* Updating documentation

* Multiple changes
*  Support for ConfigMap
*  Custom MongoDB container for BigchainDB
*  Update documentation to run a single node on k8s

* Additional documentation

* Documentation to add a node to an existing BigchainDB cluster

* Commit on rolling upgrades

* Fixing minor documentation mistakes

* Documentation updates as per @ttmc's comments

* Block formatting error

* Change in ConfigMap yaml config
2017-03-15 16:22:49 +01:00

93 lines
2.4 KiB
YAML

########################################################################
# This YAML file desribes a StatefulSet with a service for running and #
# exposing a MongoDB service. #
# It depends on the configdb and db k8s pvc. #
########################################################################
apiVersion: v1
kind: Service
metadata:
name: mdb
namespace: default
labels:
name: mdb
spec:
selector:
app: mdb
ports:
- port: 27017
targetPort: 27017
name: mdb-port
type: LoadBalancer
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mdb
namespace: default
spec:
serviceName: mdb
replicas: 1
template:
metadata:
name: mdb
labels:
app: mdb
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongodb
# TODO(FIXME): Do not use latest in production as it is harder to track
# versions during updates and rollbacks. Also, once fixed, change the
# imagePullPolicy to IfNotPresent for faster bootup
image: bigchaindb/mongodb:latest
env:
- name: MONGODB_FQDN
valueFrom:
configMapKeyRef:
name: mdb-fqdn
key: fqdn
- name: MONGODB_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
args:
- --replica-set-name=bigchain-rs
- --fqdn=$(MONGODB_FQDN)
- --port=27017
- --ip=$(MONGODB_POD_IP)
securityContext:
capabilities:
add:
- FOWNER
imagePullPolicy: Always
ports:
- containerPort: 27017
hostPort: 27017
name: mdb-port
protocol: TCP
volumeMounts:
- name: mdb-db
mountPath: /data/db
- name: mdb-configdb
mountPath: /data/configdb
resources:
limits:
cpu: 200m
memory: 768Mi
livenessProbe:
tcpSocket:
port: mdb-port
successThreshold: 1
failureThreshold: 3
periodSeconds: 15
timeoutSeconds: 1
restartPolicy: Always
volumes:
- name: mdb-db
persistentVolumeClaim:
claimName: mongo-db-claim
- name: mdb-configdb
persistentVolumeClaim:
claimName: mongo-configdb-claim