Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster autoscaling #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ credentials.json
*.pfx

terraform.tfvars
.certs
46 changes: 33 additions & 13 deletions terraform/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ resource "google_compute_subnetwork" "default" {
ip_cidr_range = "10.0.0.0/24"
}

resource "google_container_cluster" "default" {
provider = google-beta
project = var.project_id
name = var.gke_cluster_name
location = var.zone
initial_node_count = var.num_nodes
# More info on the VPC native cluster: https://cloud.google.com/kubernetes-engine/docs/how-to/standalone-neg#create_a-native_cluster
networking_mode = "VPC_NATIVE"
network = google_compute_network.default.name
subnetwork = google_compute_subnetwork.default.name
# Disable the Google Cloud Logging service because you may overrun the Logging free tier allocation, and it may be expensive
logging_service = "none"
# Node pool configuration
resource "google_container_node_pool" "primary_pool" {
name = "primary-node-pool"
cluster = "${google_container_cluster.default.name}"
project = google_compute_network.default.project
location = var.zone
node_count = var.num_nodes

autoscaling {
min_node_count = var.num_nodes
max_node_count = 10
}

node_config {
# More info on Spot VMs with GKE https://cloud.google.com/kubernetes-engine/docs/how-to/spot-vms#create_a_cluster_with_enabled
Expand All @@ -47,7 +47,27 @@ resource "google_container_cluster" "default" {
"https://www.googleapis.com/auth/servicecontrol",
]
}

management {
auto_repair = true
auto_upgrade = true
}
}

resource "google_container_cluster" "default" {
provider = google-beta
project = var.project_id
name = var.gke_cluster_name
location = var.zone
# More info on the VPC native cluster: https://cloud.google.com/kubernetes-engine/docs/how-to/standalone-neg#create_a-native_cluster
networking_mode = "VPC_NATIVE"
network = google_compute_network.default.name
subnetwork = google_compute_subnetwork.default.name
# Disable the Google Cloud Logging service because you may overrun the Logging free tier allocation, and it may be expensive
logging_service = "none"

remove_default_node_pool = "true"
# initial_node_count = 1

addons_config {
http_load_balancing {
# This needs to be enabled for the NEG to be automatically created for the ingress gateway svc
Expand Down
2 changes: 2 additions & 0 deletions terraform/scripts/install-gloo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ helm install gloo gloo/gloo \
--create-namespace \
--namespace gloo-system \
-f "$DIR/values.yaml"

true