Search code examples
mongodbgoogle-cloud-platformgoogle-kubernetes-enginemongodb-atlasgke-networking

Mongodb Atlas Google Cloud peering fails with an ip range in the local network overlaps with an ip range in an active peer


I have a GCP Project "A" where I had previously added VPC peering with MongoDB Atlas:

enter image description here

This way my development GKE cluster (whose VPC range is 10.7.0.0/16) will support peering when accessing MongoDB. So far everything works as expected.

Now I've provisioned another GKE cluster for preproduction, with its own VPC range on 10.221.0.0/16. I've also created another database in the same Mongo cluster "app-pre" and wanted to add VPC peering for the new cluster.

I followed the same steps:

  1. Mongo Atlas: add peering connection for GCP project "A", VCP name and CIDR 192.168.0.0/16
  2. GCP Create Peering Connection

The problem is I get the following error:

An ip range in the local network (10.221.0.0/16) overlaps with an ip range (10.221.0.0/16) in an active peer of the peer network

enter image description here


Solution

  • Posting this as an answer in order to help other people.

    What @john-hanley mentions is correct, basically you can't have 2 or more VPC peerings when they are using overlapping IP ranges, this is because GCP routes would be created with the same "priority" and therefore it would be confusion as to where to send a packet to those routes.

    The message you are getting is basically that you are already using one range this way and intend to use this very same range "10.221.0.0/16" again.