VPC Address Plan for GKE Cluster | Subnet Mask for Pod IP Range

Subnet Mask for Pod IP Range

Question

You need to define an address plan for a future new GKE cluster in your VPC.

This will be a VPC native cluster, and the default Pod IP range allocation will be used.

You must pre-provision all the needed VPC subnets and their respective IP address ranges before cluster creation.

The cluster will initially have a single node, but it will be scaled to a maximum of three nodes if necessary.

You want to allocate the minimum number of Pod IP addresses.

Which subnet mask should you use for the Pod IP address range?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips

When creating a new GKE cluster in a VPC, an address plan needs to be defined for the Pod IP range allocation. In a VPC native cluster, the default Pod IP range allocation is used. This means that for each node in the cluster, a /24 subnet will be created and used to assign Pod IPs.

The subnet mask determines the number of IP addresses that will be available for Pods in each /24 subnet. In order to allocate the minimum number of Pod IP addresses while accommodating up to three nodes, we need to choose a subnet mask that provides enough IP addresses for all the Pods on three nodes without wasting too many IP addresses.

For a single node, a /24 subnet mask would provide 256 IP addresses, which is more than enough for most workloads. For three nodes, we need to consider the maximum number of Pods that could be scheduled on each node, which is determined by the node's machine type and resource limits.

Assuming a standard machine type such as n1-standard-1 with a limit of 110 Pods per node, we can calculate the maximum number of Pods that could be scheduled on three nodes as follows:

3 nodes x 110 Pods/node = 330 Pods

To accommodate 330 Pods with the minimum number of IP addresses, we need to choose a subnet mask that provides at least 330 IP addresses per /24 subnet. A /22 subnet mask provides 1024 IP addresses per /24 subnet, which is more than enough for 330 Pods.

Therefore, the correct answer is B. /22.