How create MongoDB cluster on Kubernetes?
You need to setup multiple deployments and services. Take a look at this zookeeper example - https://gist.github.com/bprashanth/8160d0cf1469b4b125af95f697433934
You do not rely on node/machine IPs. Instead you rely on stable DNS names of multiple services.
Take a look at https://www.mongodb.com/blog/post/running-mongodb-as-a-microservice-with-docker-and-kubernetes, there is a great pdf tutorial.