Automate MongoDB Replica configuration on Kubernet

I am creating a MongoDB cluster on Kubernetes using Stateful suites. I have 3 mongo replicas configured in my state set.

Now I create a set of states and a service using only one command

kubectl create -f mongo-stateful.yaml

Then I use the mongo client to start the mongo replica set items.

rs.initiate( { _id: "replicaset1", version: 1, members: [ { _id: 0, host:port1 }, { _id: 1, host : host:port1 }, { _id: 2, host : host:port1 } ] } ) 

All this works, except that I would like to automate this step in setting up replica set items.

My questions are: can this step be automatic, and if we can add this to the yaml file?

+5
source share
1 answer

Source: https://habr.com/ru/post/1263358/


All Articles