Question

How To Connect The Kubernetes Cluster to DigitalOcean Managed MongoDB with TLS Enabled?

Posted October 17, 2021 210 views
DigitalOcean Managed KubernetesDigitalOcean Managed MongoDB Database

Hello experts,

I am trying several way to access my Kubernetes cluster to DigitalOcean managed MongoDB which enabled TLS (as MongoDB 4.4).

Anyone have experiences to setup the Kubernetes cluster to connect to the TLS enabled MongoDB, I am very much appreciated.

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @chanvi,

You can download the ca-certificate file from the MongoDB connection details from the database page and copy the content from the file to create crt file in the Kubernetes cluster.

The below link can guide you with downloading the ca-certificate file :

https://docs.digitalocean.com/products/databases/mongodb/how-to/connect/

If you are facing any issue on this; you can try adding “tlsAllowInvalidCertificates” in the MongoDB connection string to connect without a ca-certificate.

mongo "mongodb+srv://doadmin:password@db-mongodb-nyc3-xxxxxx-xxxxxxxxxxx.mongo.ondigitalocean.com/admin?authSource=admin" --tls --tlsAllowInvalidCertificates

For more information on TLS settings for Node js :
https://mongodb.github.io/node-mongodb-native/3.5/tutorials/connect/tls/

I hope this helps!

Regards,
Rajkishore