Bird
Raised Fist0
GCPcloud~10 mins

Node pools and auto scaling in GCP - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the minimum number of nodes in a node pool.

GCP
resource "google_container_node_pool" "primary_nodes" {
  name       = "primary-node-pool"
  cluster    = google_container_cluster.primary.name
  node_count = [1]
}
Drag options to blanks, or click blank then click option'
A3
B0
C10
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative number for node_count
Setting node_count to zero which disables the pool
2fill in blank
medium

Complete the code to enable autoscaling for the node pool.

GCP
resource "google_container_node_pool" "autoscaling_pool" {
  name       = "autoscale-pool"
  cluster    = google_container_cluster.primary.name
  autoscaling {
    min_node_count = 1
    max_node_count = [1]
  }
}
Drag options to blanks, or click blank then click option'
A5
B0
C-3
D1000
Attempts:
3 left
💡 Hint
Common Mistakes
Setting max_node_count less than min_node_count
Using negative numbers for max_node_count
3fill in blank
hard

Fix the error in the autoscaling block by completing the missing field.

GCP
resource "google_container_node_pool" "fixed_pool" {
  name       = "fixed-pool"
  cluster    = google_container_cluster.primary.name
  autoscaling {
    [1] = 2
    max_node_count = 5
  }
}
Drag options to blanks, or click blank then click option'
Anode_count
Bmin_node_count
Cmax_node_count
Dinitial_node_count
Attempts:
3 left
💡 Hint
Common Mistakes
Using node_count inside autoscaling block
Omitting min_node_count causes errors
4fill in blank
hard

Fill both blanks to configure autoscaling with a minimum of 2 nodes and a maximum of 6 nodes.

GCP
resource "google_container_node_pool" "scale_pool" {
  name       = "scale-pool"
  cluster    = google_container_cluster.primary.name
  autoscaling {
    min_node_count = [1]
    max_node_count = [2]
  }
}
Drag options to blanks, or click blank then click option'
A2
B6
C10
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping min and max values
Setting min higher than max
5fill in blank
hard

Fill all three blanks to create a node pool with autoscaling enabled, minimum 1 node, maximum 4 nodes, and initial node count 2.

GCP
resource "google_container_node_pool" "full_pool" {
  name               = "full-pool"
  cluster            = google_container_cluster.primary.name
  initial_node_count  = [1]
  autoscaling {
    min_node_count = [2]
    max_node_count = [3]
  }
}
Drag options to blanks, or click blank then click option'
A1
B2
C4
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting initial_node_count outside min-max range
Using max_node_count less than min_node_count

Practice

(1/5)
1. What is the main purpose of a node pool in a GKE cluster?
easy
A. To group similar machines for easier management and scaling
B. To store data permanently in the cluster
C. To monitor network traffic between nodes
D. To create backups of the cluster configuration

Solution

  1. Step 1: Understand node pool concept

    A node pool is a set of nodes with the same configuration in a cluster.
  2. Step 2: Identify node pool purpose

    Node pools help manage and scale groups of similar machines easily.
  3. Final Answer:

    To group similar machines for easier management and scaling -> Option A
  4. Quick Check:

    Node pool = group similar machines [OK]
Hint: Node pools group similar nodes for scaling and management [OK]
Common Mistakes:
  • Confusing node pools with storage or backup features
  • Thinking node pools monitor network traffic
  • Assuming node pools store data permanently
2. Which of the following is the correct way to enable auto scaling on a node pool using gcloud CLI?
easy
A. gcloud container clusters create CLUSTER_NAME --autoscaling
B. gcloud container node-pools update POOL_NAME --enable-autoscaling --min-nodes=1 --max-nodes=5
C. gcloud container node-pools create POOL_NAME --autoscaling-enabled
D. gcloud container node-pools set-autoscale POOL_NAME --min=1 --max=5

Solution

  1. Step 1: Recall gcloud syntax for node pool auto scaling

    The correct command uses 'node-pools update' with '--enable-autoscaling' and min/max nodes.
  2. Step 2: Match options with correct syntax

    gcloud container node-pools update POOL_NAME --enable-autoscaling --min-nodes=1 --max-nodes=5 matches the correct syntax and flags for enabling auto scaling.
  3. Final Answer:

    gcloud container node-pools update POOL_NAME --enable-autoscaling --min-nodes=1 --max-nodes=5 -> Option B
  4. Quick Check:

    Enable autoscaling with update and min/max nodes [OK]
Hint: Use 'node-pools update' with --enable-autoscaling and min/max nodes [OK]
Common Mistakes:
  • Using cluster create command to enable node pool autoscaling
  • Incorrect flag names like --autoscaling-enabled
  • Commands that do not specify min and max nodes
3. Given a node pool with auto scaling enabled (min nodes=2, max nodes=4), what happens when workload increases beyond current capacity?
medium
A. The node pool scales up by adding nodes up to the max limit
B. The node pool scales down to reduce costs
C. The cluster deletes existing nodes to balance load
D. The workload is rejected until manual scaling is done

Solution

  1. Step 1: Understand auto scaling behavior on workload increase

    Auto scaling adds nodes when workload exceeds current capacity, up to max nodes.
  2. Step 2: Analyze options

    The node pool scales up by adding nodes up to the max limit correctly describes scaling up; others describe incorrect or opposite behaviors.
  3. Final Answer:

    The node pool scales up by adding nodes up to the max limit -> Option A
  4. Quick Check:

    Workload increase triggers scale up [OK]
Hint: Auto scaling adds nodes when workload grows, up to max nodes [OK]
Common Mistakes:
  • Thinking auto scaling scales down on workload increase
  • Assuming nodes are deleted to balance load
  • Believing workload is rejected without manual scaling
4. You configured auto scaling on a node pool but notice nodes are not scaling up despite high CPU usage. What is the most likely cause?
medium
A. Auto scaling is disabled on the node pool
B. The node pool has no nodes initially
C. The cluster is in maintenance mode
D. The max nodes limit is set too low

Solution

  1. Step 1: Check auto scaling settings

    If auto scaling is enabled but nodes don't increase, max nodes limit may be reached.
  2. Step 2: Identify cause of no scale up

    The max nodes limit is set too low explains that max nodes limit is too low to add more nodes despite workload.
  3. Final Answer:

    The max nodes limit is set too low -> Option D
  4. Quick Check:

    Max nodes limit blocks scaling up [OK]
Hint: Check max nodes limit if scaling doesn't happen [OK]
Common Mistakes:
  • Assuming auto scaling is disabled without checking limits
  • Ignoring max nodes limit as a cause
  • Thinking cluster maintenance mode blocks scaling always
5. You want to optimize costs by using multiple node pools with different machine types and enable auto scaling only on the pool handling variable workloads. Which approach is best?
hard
A. Disable auto scaling on all node pools and manually adjust nodes daily
B. Use a single node pool with auto scaling enabled for all workloads
C. Create a small fixed node pool for stable workloads and a separate auto scaling node pool for variable workloads
D. Create multiple auto scaling node pools with the same machine type

Solution

  1. Step 1: Understand workload types and node pools

    Stable workloads benefit from fixed nodes; variable workloads benefit from auto scaling.
  2. Step 2: Choose best cost optimization strategy

    Create a small fixed node pool for stable workloads and a separate auto scaling node pool for variable workloads separates stable and variable workloads into different pools with appropriate scaling.
  3. Final Answer:

    Create a small fixed node pool for stable workloads and a separate auto scaling node pool for variable workloads -> Option C
  4. Quick Check:

    Separate pools for stable and variable workloads optimize cost [OK]
Hint: Use fixed pool for stable, auto scaling pool for variable workloads [OK]
Common Mistakes:
  • Using single auto scaling pool for all workloads
  • Disabling auto scaling and relying on manual scaling
  • Creating multiple auto scaling pools with same machine type unnecessarily
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard