I have created a private cluster in GCP using terraform modules. As per the documentation here: https://www.terraform.io/docs/providers/google/r/container_cluster.html#master_ipv4_cidr_block, I have configured the private cluster as below:
private_cluster_config {
enable_private_endpoint = true
enable_private_nodes = true
master_ipv4_cidr_block = "${cidrsubnet(var.cidr, 28, 1)}"
}
This cluster is provisioned in a subnet whose CIDR range is 10.15.0.0/16 (var.cidr
is set to 10.15.0.0/16).
When I run terraform apply, I get the below error:
Error waiting for creating GKE cluster: The given master_ipv4_cidr 10.15.0.16/28 overlaps with an existing network 10.15.0.0/16.
"${cidrsubnet(var.cidr, 12, 1)}"
How do I provide the master_ipv4_cidr_block IPV4 address range and subnet range using value provided in var.cidr
so that the ranges dont overlap?
How should the cidrsubent() be modified to suit this requirement?
As you already identified, this is because there is a cidrsubent overlap, using a different subnet would be the best, but perhaps google cloud platform could help you more via a support ticket