Created
November 10, 2020 13:25
-
-
Save cassanellicarlo/77446c230a07d75f2c2e34a0c4d1f81d to your computer and use it in GitHub Desktop.
Terraform - Google Cloud Kubernetes Cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_container_cluster" "primary" { | |
name = "my-gke-cluster" | |
location = "us-central1" | |
# We can't create a cluster with no node pool defined, but we want to only use | |
# separately managed node pools. So we create the smallest possible default | |
# node pool and immediately delete it. | |
remove_default_node_pool = true | |
initial_node_count = 1 | |
master_auth { | |
username = "" | |
password = "" | |
client_certificate_config { | |
issue_client_certificate = false | |
} | |
} | |
} | |
resource "google_container_node_pool" "primary_preemptible_nodes" { | |
name = "my-node-pool" | |
location = "us-central1" | |
cluster = google_container_cluster.primary.name | |
node_count = 1 | |
node_config { | |
preemptible = true | |
machine_type = "e2-medium" | |
metadata = { | |
disable-legacy-endpoints = "true" | |
} | |
oauth_scopes = [ | |
"https://www.googleapis.com/auth/cloud-platform" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment