3
votes

I am following this tutorial to configure Kubernetes on GCP. https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app#clean-up

I run this command to create a cluster following the suggestion from here - GKE: Insufficient regional quota to satisfy request: resource "IN_USE_ADDRESSES"

gcloud container clusters create name-cluster --num-nodes=2

When I list the nodes using gcloud compute instances list I notice that I have got more than 2 nodes!! Why?

NAME                          LOCATION      MASTER_VERSION  MASTER_IP      MACHINE_TYPE   NODE_VERSION    NUM_NODES  STATUS
name-cluster  europe-west4  1.14.10-gke.36  34.91.182.235  n1-standard-1  1.14.10-gke.36  6 <-- why not 2         RUNNING

gcloud compute instances list
gke-name-cluster-default-pool-6eb04e1c-8v7v  europe-west4-a  n1-standard-1                           10.164.0.7   34.91.242.41    RUNNING
gke-name-cluster-default-pool-6eb04e1c-k2c7  europe-west4-a  n1-standard-1                           10.164.0.8   34.91.149.207   RUNNING
gke-name-cluster-default-pool-aa8d2ab0-9508  europe-west4-b  n1-standard-1                           10.164.0.11  34.91.209.197   RUNNING
gke-name-cluster-default-pool-aa8d2ab0-vpv2  europe-west4-b  n1-standard-1                           10.164.0.12  35.204.159.132  RUNNING
gke-name-cluster-default-pool-ae1131d2-9q50  europe-west4-c  n1-standard-1                           10.164.0.10  34.90.135.116   RUNNING
gke-name-cluster-default-pool-ae1131d2-l29c  europe-west4-c  n1-standard-1                           10.164.0.9   34.91.4.206     RUNNING
2

2 Answers

2
votes

Argument num-nodes is the number of nodes in the pool in a zonal cluster. If you use multi-zonal or regional clusters, num-nodes is the number of nodes for each zone the node pools is in.

In your case, GKE cluster is deployed in europe-west4 region and it created 2 nodes in each zone(europe-west4-a, europe-west4-b, europe-west4-c).

For more reference resizing cluster

1
votes

Did you set the compute/zone property like suggested in the tutorial you followed?

Like:

gcloud config set compute/zone europe-west4-b

Check it with:

gcloud config get-value compute/zone

Or you can set it directly as an argument when creating the cluster:

gcloud container clusters create cluster-name --num-nodes=2 --zone=europe-west4-b

I see that LOCATION of your cluster is europe-west4 which is a whole region, and not a zone. And since the region europe-west4 has 3 zones (a, b, c), it created 3 * 2 instances, as explained in Gautam Savaliya's answer