- Deploy and Configure MongoDB Database Resources >
- Access Database Resources >
- Connect to a MongoDB Database Resource from Inside Kubernetes
Connect to a MongoDB Database Resource from Inside Kubernetes¶
The following procedure describes how to connect to a MongoDB resource deployed by Kubernetes from inside of the Kubernetes cluster.
Considerations¶
You must be able to connect to the host and port where you deployed your Kubernetes resource. To learn more about connecting to your deployment, see Connect to a MongoDB Process.
Procedure¶
Perform the following steps in the Ops Manager or Cloud Manager application, depending on where your clusters are hosted:
1
Open the Topology view for your deployment.¶
Click Deployment in the left navigation.
2
Click ¶
for the deployment to which you want to connect.3
Click Connect to this instance.¶
4
Copy the connection command displayed in the Connect to your Deployment dialog.¶
5
Run the connection command in a terminal to connect to the deployment.¶
Example
To connect to a sharded cluster resource named
shardedcluster
, you might use the following connection
string:
When connecting to a resource from inside of Kubernetes, the hostname to which you connect has the following form: