Access to Mongodb in Kubernetes

g4challenge picture g4challenge · Apr 13, 2016 · Viewed 11.9k times · Source

I created a Mongodb service according to the Kubernetes tutorial.

Now my question is how do I gain access to the database itself, with a client like Robomongo or similar clients? Just for making backups or exploring what data have been entered.

The mongo-pod and service only have an internal endpoint, and a single mount.

Is there any way to safely access this instance with no public endpoint?

Internally URI is mongo:27***

Answer

lmcarreiro picture lmcarreiro · Aug 19, 2018

You can use kubectl port-forward mypod 27017:27017 and then just connect your mongodb client to localhost:27017.

If you want to stop, just hit Ctrl+C on the same cmd window to stop the process.