What valid cidr can I assign to my GKE cluster?

2/18/2019

I'm trying to set up a subnetwork and a cluster in GCP.

I've successfully created a subnet with the cidr like 10.0.13.0 with a subnet mask of 24.

What I'm confused about is that the examples I've been looking at assign the subnet to the cluster, they also assign a cidr to the cluster too.

Is this cidr a separate subnet, or is it defining a range of IPs within the subnet I created?

If it's the former, what's the point in assigning a subnet to the cluster? If it's the latter, how do I pick a cidr that's valid?

So far I've just tried assigning the same cidr to both the cluster and the subnet, but gcloud fails to create the cluster if I do so.

-- Andy
google-cloud-platform
google-kubernetes-engine
networking

1 Answer

2/18/2019

This is a separate subnet. Basically you are choosing the subnetwork to which the GKE cluster belongs to.

By default, once you create new cluster it wil be using routes based network mode. A routes-based cluster has a range of IP addresses that are used for pods and services where clusterIPv4Cidr is called the pod address range and servicesIpv4Cidr for services. You may also view them as secondary ranges

-range for pod ip addresses

-range for services ip addresses

The goal of assigning a network to your cluster is to determine which other compute engine resources it is able to communicate with.

-- dany L
Source: StackOverflow