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.
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.