Can you share pod and service secondary_ip_range between GKE clusters?

5/3/2021

I have created subnets in GCP with allotted secondary IP ranges for pods and services. And have started a GKE cluster by providing the above secondary IP ranges for services and pods. Lets call this cluster-A.

Now I want to create another GKE cluster within same region, and want to use same subnets. Can I use the same secondary IP ranges, which I provided for cluster-A, to create a new GKE-cluster?

My assumptions is, both the clusters will be provided IPs from the common subnet and secondary ranges, and there won't be any conflict. GCP would take care of it. But I am not sure of this, so can't move forward, fearing this might break my existing cluster.

The secondary IP ranges are big enough to accommodate services and pods of both the cluster.

Can anybody help me with this? Share some knowledge. Thanks.

-- dilettante_aficionado
google-kubernetes-engine
kubernetes
subnet

1 Answer

5/7/2021

The pod secondary CIDR ranges and sub-networks can be shared across multiple clusters. However, Services secondary CIDR ranges must be different across multiple clusters and cannot be shared because secondary service ranges are unique to a given cluster.

Sharing IP ranges is not recommended as :

1.It can add extra noise in the networks.

2.The IP range that the subnet is using to assign to Nodes/Pods is now effectively shared among clusters.This can lead to IP exhaustion since one cluster may use more IP's than another one and this may leave the second cluster incapable of using more IP's which can’t create more nodes.

For more information refer the link:

https://cloud.google.com/kubernetes-engine/docs/concepts/alias-ips#cluster_sizing_secondary_range_svcs

-- Jyothi Kiranmayi
Source: StackOverflow