I want to install mongodb on kubernetes cluster using master/slave concept

Hi All,

I want to install mongodb on GKE Cluster and I’m new to MongoDB dont know which procedure do i follow to install or setup

My conditions

  1. It should have master and slave concept
  2. i want to install mongodb using helm chart or kubectl whichever is that
  3. first i will install in dev env and in production also
  4. Im installing in GKE
  5. im looking for opensource mongodb not PAID

Please share me any link or video or docs to easily understand and install

Hi @Mohd_Rashid and welcome to MongoDB community forums!!

Based on the above statement, if you are looking to install MongoDB in master slave concept, the feature has been shut down since MongoDB version 4.0.
Hence the recommendation would be to use the latest version for new features and bug fixes.

In order to install MongoDB in a kubernetes environment, you can perform the same using help charts and kubectl function.
If you have install Google Kubernetes environment, you use the access link to access the environment and create the deployment, service and other yaml files.
You can follow the steps present in one of my posts as part of 100DaysOfCode challenge.

However, in saying so, if you wish to use MongoDB on a kubernetes production environment, I would recommend to use MongoDB Kubernetes Operator for its improved management and operational support.
You can follow the blog posts on Deploying the MongoDB Enterprise Kubernetes Operator on Google Cloud for further understanding.

Best Regards

OK thanks for that help sure i will check those links which u have given to me

but last question if not master and slave concept can u suggest me which should i install and setup


Plse suggest which is good for production and dev ENV and also plse send me link where i can follow and install it

Hi @Mohd_Rashid

Master slave in replica set was a concept used in the older version. After 4.0, the replica set deployment follows the concepts of primary and secondary nodes.

If you wish to deploy MongoDB in a kubernetes environment, it can be done using both the replica seta and the sharding concepts using the Kubernetes operator.
However, if you have to use between replica set and sharding, it purely depends on your use case.

A replica set is a deployment with primary and secondary (and arbiters) which could be used to ensure data availability in a distributed environment and provide enough redundancy to survive most network partitions and other system failures.

If your current workload is not able to handle request, horizontal scaling could be one of the possible solutions you can go with. Sharding in MongoDB allows you to scale your deployment horizontally to allow equal distribution of workload among the servers.

Both of these deployments could be done in the kubernetes environment. The difference would only occur on how the yaml files have been deployed.

The steps mentioned below would help you deploy:

  1. Replica set in MongoDB Kubernetes Operator
  2. Sharded cluster in MongoDB Kubernetes Operator.

Please let us know if you have any further questions.

Best Regards

Thank You

very much definitely i will follow your guidance to install/setup mongodb in Dev Env then in Production En.

Already my company is using mongodb atlas in AWS.

My job is to install/setup mongodb which is best for company in k8s then need to Migrate data from AWS to GCP.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.