/charm-k8s-mongodb

Kubernetes Charm/Operator for MongoDB

Primary LanguagePython

Juju Charm for MongoDB on Kubernetes

CI Badges

Click on each badge for more details.

Branch Build Status Coverage
master Build Status (master) Coverage Status

Overview

MongoDB for Juju CAAS

Usage

To use, first pull in dependencies via git submodule:

git submodule init
git submodule update

Then, deploy the charm with an appropriate image resource:

juju --debug deploy . --resource mongodb-image=mongo:3.1 --resource mongodb-sidecar-image=mongo-sidecar:3.1

Scale out usage

To add a replica to an existing service:

juju add-unit mongodb-k8s

Scale down usage

In order to scale the units down with MongoDB PVCs termination an action needs to be run against last unit. Example for setup with 3 mongodb units:

juju run-action mongodb-k8s/2 remove-pvc
juju remove-unit -n 1 mongodb-k8s

Connection

In order to connect to standalone mongodb host the URI is:

mongo mongodb://mongodb-k8s-0.mongodb-k8s:27017

Where bash mongodb-k8s-0 is the name of a pod.

In order to connect to a replicaSet 'rs0' the URI is:

mongo mongodb://mongodb-k8s-0.mongodb-k8s:27017,mongodb-k8s-1.mongodb-k8s:27017,mongodb-k8s-2.mongodb-k8s:27017/?replicaSet=rs0

For more information on connection to MongoDB see https://docs.mongodb.com/manual/reference/connection-string/#mongodb-uri.

Architecture

No-HA scenario architecture overview:

No-HA

HA-scanario architecture overview:

HA