Is there any mongodb Replica Set monitoring projects for docker/kubernetes?

4/8/2020

First of all i am trully sorry for the whole bunch long description of my setup. But i really want to explain reason for the question.

Building a kubernetes mongo db replica set.

For now it is N mongo nodes, one of these with bigger priority than others to have a master.

Each mongo node (replicaset member) is implemented as StatefulSet with exactly 1 replica in it. Not planning to do automatic scale up or down because I understand that adding one node to replica set is actually pretty heavy operation - mongo have to sync all the data into it before it can take some load. Thus automatic scale up on bigger demand looses whole point - since it is actually going to increase load on existing nodes to populate new one for a while.

So my idea is to have fixed SatefulSets so i can control everything i need and i can always add others if i need to.

Doing Initialization of replicaset manually by running command on running pod once it first started. And add all memebers to it. Doing it as simple as running this rs.initiate({....})

Everything works just fine until kubernetes decides to move one of the member from one k8s node to another k8s node (probably because it have some heavy stuff starting to happen on that kubernetes node or whatever else reason).

Once mongo replicaset member is moved it becomes unreachable from replicaset point of view. Which totally make sense because it was off and on again by the k8s system. and mongo removes it from replica.

To fix that i have to reconfigure my replicaset to include back mongo replicaset member which was moved by the k8s system. It is pretty straight forward rs.reconfig({....}, {force: true}). But in my case it had to be execute manually - once i noticed unreachable mongo member. Which is not cool at all.

So my idea was to build a simple k8s mongo replicaset monitoring pod which would run rs.status() against mongo replicaset and monitor that everybody is there. Or otherwise run rs.reconfig(...) once someone is out of replica. Also it would be easy add some notification into this monitoring pod - so i see echo somewhere. This pod probably would be implemented as plain ubuntu with infinity loop shell script with delay and python script which would do all the magic with mongo and notification.

Don't really like the idea of a sidecar for each mongo because it is an extra pod for each mongo pod from what i understand. So to have one monitoring pod sounds way better as for me. beside that i am using mongo 3.2 so existing sidecar stuff not really working.

and finally my question - is there anything like light mongo monitoring docker image already exists somewhere? wasn't able to find anything like this...

UPDATE since no answers had to build my own monitoring image - works just fine.

-- user2932688
kubernetes
mongodb
monitoring
replicaset

0 Answers