Search code examples
kubernetesamazon-eksmongodb-atlasaws-vpc-peering

Failed to access MongoDB Atlas cluster from eks pod with peering connection setup


Getting error:

socket timeout calling ismaster on 'custer-name-shard-00-00.somekey.mongodb.net:27017'

When trying to access MongoDB Atlas cluster from a pod deployed on AWS EKS. Whereas I get successful connection when adding 0.0.0.0/0 to MongoDB Atlas IP Access list, so I thing request is not routed through peering connection.

Please could you explain me how to ensure appropriate routing though MongoDB Altas VPC peering connection.

I exposed MongoDB connection test pod using a LoadBalancer Service which allow to enter MongoDB cluster settings.

I tried dnsPolicy: "ClusterFirstWithHostNet" and dnsPolicy: "Default" in deployment yml (using Helm).


Solution

  • I was finally able to make my vpc peering functional by relying on the official documentation available on the following links: