I am running a MongoDB service in Kubernetes and I am trying to connect with MongoDB service to another back-end services. I deployed MongoDB service to following codelabs tutorial. here is the tutorial link
MongoDB service is running properly and I can create a database through a shell command.
when I try to connect with nodejs back-end using mongoose
I am getting below error
MongoError: no mongos proxy available
here is my mongos connection URL
mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo:27017/food_content
First of all that tutorial was last updated on Feb/2017. I recommend you to read a more recent tutorial.
You should read about how Services work. In particular, according to this doc you can access a service through
$(service name).$(namespace).svc.cluster.local
And a Pod with:
$(podname).$(service name).$(namespace).svc.cluster.local
Example:
mongo-0.mongo.default.svc.cluster.local