Search⌘ K
AI Features

Creating Worker Nodes

Explore how to create and manage worker nodes in Google Kubernetes Engine clusters using Terraform. Understand node pool definitions, autoscaling settings, and version control. Gain practical knowledge of infrastructure as code in Terraform and ensure your Kubernetes cluster setup is efficient and maintainable.

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

Shell
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.

  • ...