Skip to content

jadenlemmon/terraform-google-cheap-gke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cheap GKE Cluster Terraform Module

Creating a GKE cluster in GCP often leaves you with default settings that aren't cost-effective. It's fair to say, for the purpose of creating clusters for testing and development, there's no need for features like multi-region, high availability, load balancers, and so on.

This module gives you a simple, no-fuss way to set up a GKE cluster that's optimized for development purposes. It's a result of extensive research to find a cost-effective solution.

Among all GCP regions, us-central1 offers the most economical rates.

Spot instances are another way to trim your budget, offering a substantial discount of around 75% or more when compared to standard instances. By default, we utilize two node pools. The first, named ingress, operates on a single e2-small instance, serving as a budget-friendly load balancer. To ensure uninterrupted operation, this instance does not run on spot instances. The second node pool, shared, is configured to handle all additional workloads using spot instances.

Example Usage

module "cheap-gke" {
  source  = "jadenlemmon/cheap-gke/google"

  project_id = "PROJECT_ID"
  region     = "us-central1"
}

Release Process

Generate docs

terraform-docs markdown table --output-file README.md --output-mode inject ./

Push a new tag and then draft a new Github Release.

git tag v0.1.0 && git push --tags

Requirements

No requirements.

Providers

Name Version
google n/a
google-beta n/a
random n/a

Modules

No modules.

Resources

Name Type
google-beta_google_compute_address.static-ingress resource
google-beta_google_container_cluster.default resource
google_compute_firewall.default resource
google_compute_network.default resource
google_compute_router.router resource
google_compute_router_nat.nat resource
google_compute_subnetwork.default resource
google_container_node_pool.node-pools resource
random_string.unique_id resource

Inputs

Name Description Type Default Required
cluster_ipv4_cidr_block The CIDR range for the cluster pods string "10.2.0.0/18" no
cluster_subnetwork_cidr_range The CIDR range for the cluster subnetwork string "10.0.0.0/24" no
default_machine_type The default machine type for the cluster nodes string "e2-small" no
disk_size The disk size of the cluster nodes number 20 no
gke_cluster_name The name of the cluster string "gke-cheap-cluster" no
master_ipv4_cidr_block The CIDR range for the master nodes string "10.1.0.0/28" no
network_name The name of the network string "gke-cluster-network" no
node_pools n/a map
{
"ingress": {
"auto_repair": true,
"auto_upgrade": true,
"disk_size_gb": 10,
"disk_type": "pd-standard",
"initial_node_count": 1,
"max_node_count": 1,
"min_node_count": 1,
"spot": true,
"tags": [
"ingress"
],
"taints": [
{
"effect": "NO_EXECUTE",
"key": "ingress",
"value": true
}
]
},
"shared": {
"auto_repair": true,
"auto_upgrade": true,
"disk_size_gb": 20,
"disk_type": "pd-standard",
"initial_node_count": 1,
"max_node_count": 5,
"min_node_count": 1,
"spot": true,
"tags": [
"shared"
],
"taints": []
}
}
no
num_nodes The number of cluster nodes number 1 no
project_id The project ID to host the cluster in any n/a yes
region The region to host the cluster in string "us-central1" no
services_ipv4_cidr_block The CIDR range for the cluster services string "10.3.0.0/18" no
zone The zone to host the cluster in (required if is a zonal cluster) string "us-central1-a" no

Outputs

Name Description
google_compute_address n/a
google_container_cluster n/a