Automating MongoDB Replica set configuration on Kubernetes Automating MongoDB Replica set configuration on Kubernetes mongodb mongodb

Automating MongoDB Replica set configuration on Kubernetes


Yes, it is possible, you have several choices:

  1. Use the sidecar approach as specified by @tzik, then you don't need to do much in your code
  2. Use the kubernetes lifecycle.postInstall feature to implement the clustering on your own (this is a bit tricky, because postInstall runs on each statefulset member)
  3. Use if you decide to use helm to manage your k8s deployments, then you can use helm post-install hooks to initiate your mongodb cluster.