Creating Worker Nodes

Learn how to create worker nodes and view them using Terraform.

Defining worker nodes

We can manage worker nodes through the google_container_node_pool module. We’ve prepared yet another definition that we can use.

Explaining the output

Press + to interact
resource "google_container_node_pool" "primary_nodes" {
name = var.cluster_name
location = var.region
cluster = google_container_cluster.primary.name
version = var.k8s_version
node_config {
preemptible = var.preemptible
machine_type = var.machine_type
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
}
autoscaling {
min_node_count = var.min_node_count
max_node_count = var.max_node_count
}
management {
auto_upgrade = false
}
timeouts {
create = "15m"
update = "1h"
}
}

That definition is a bit bigger than the ones we’ve used before. There are more things we might want to define for worker nodes, so that definition has a few more fields than others.

  • Lines 2–4: ...

Get hands-on with 1400+ tech skills courses.