Cant connect to mongodb atlas

#11 24.79 2022-12-14T02:35:50.678Z INFO 82 --- [] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server #11 24.79 #11 24.79 com.mongodb.MongoSocketReadException: Prematurely reached end of stream

I need to know the ip of the kubernetes node to allow the connection in mongodb atlas

Hey @rubengarcia0510 , welcome to our community!

Where are you running your remote development environment?

We don’t publish the outbound IPs of, since they are constantly changing.
Due to their cost, Static outbound IPs are something we only offer in the Scale and Enterprise tiers of our SaaS product.

To use MongoDB Atlas with, you’ll need to either allow all IPs or, even better, look for another security model.

There are a way to use a database in okteto?

Yes, you can deploy any container-based database as part of your development environment. We have examples on GitHub - okteto/samples: Learn how to develop with Okteto that show how to do it for different stacks and application deployment manifests.

I deployed this container

What do you think is the url to connect to the mongodb database?

Thank you

Ruben Garcia

To connect from another container on the same namespace, the format would be:


In the case of the example, assuming you are using default configurations for MongoDB, it would be:


And to connect to other namespace?

Ok, as you told me, I was deployed the database in the same namespace of the backend, but it’s still failing the connection to the mongodb database

To connect to other namespace, you need to use $serviceName.$namespace as the host name.

Is hard to tell what’s going on without knowing how you are connecting to mongodb. Maybe try different credentials, or setting up the database on the connection string?

What I recommend you do is to do okteto up into the backendReactive service that you are developing… That will give you a remote terminal into your service. You can use that to iterate on your code until you figure out how to correctly connect to the DB, or if there are other issues around. This is a good way to get started with okteto up.