【发布时间】:2021-12-30 12:33:48
【问题描述】:
我关注https://docs.atlas.mongodb.com/security-vpc-peering/ 并创建了 VPC 对等互连并检查了激活的双方(GCP 和 Atlas)。 并且我的 GCP VPC-native 已启用。
mongodb cidr 192.168.0.0/16
GCP pod ip 范围 10.4.0.0/16
我将 10.4.0.0/16 添加到 Atlas 白名单 并尝试通过其中一个 pod 中的私有连接字符串进行连接
mongo "mongodb+srv://id:pass0@dbname-pri.some.mongodb.net/dbname"
但它返回错误
*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP allowlist allows connections from your network.
Error: Could not find host matching read preference { mode: "nearest" }
nslookup 在 pod 中显示到 mongodb 集群
Server: 10.4.128.10
Address: 10.4.128.10#53
Name: dbname-pri.some.mongodb.net
Address: 192.168.254.213
我刚刚将白名单 0.0.0.0/0 添加到 Atlas 中。但它返回相同的错误。肯定不是白名单的问题。
我应该设置防火墙还是其他?
【问题讨论】:
标签: google-kubernetes-engine mongodb-atlas vpc-peering