fbpx

Elastigroup GKE

This post demonstrates how to create an Elastigroup with GKE using the Spotinst Terraform V2 plugin.

This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation.

Creating an GKE Elastigroup

 

Example Usage – Creating an GKE Elastigroup resource – Basic Example

resource "spotinst_elastigroup_gke" "example_gke_group" {
  name = "example-gke"

  cluster_zone_name = "us-central1-a"
  cluster_id = "example-cluster"
  node_image = "COS"

  instance_types_ondemand = "n1-standard-1"
  instance_types_preemptible = ["n1-standard-1"]

  min_size         = 0
  max_size         = 3
  desired_capacity = 1
  preemptible_percentage = 75
}

 

Parameters

name – (Required) The group name.

max_size – (Required) The maximum number of instances the group should have at any time.
min_size – (Required) The minimum number of instances the group should have at any time.
desired_capacity – (Required) The desired number of instances the group should have at any time.

availability_zones – (Required) List of availability zones for the group.

cluster_id – (Required) The name of the GKE cluster you wish to import.
node_image – (Optional, Default: `COS`) The image that will be used for the node VMs. Possible values: COS, UBUNTU.

instance_types_preemptible – (Required) The preemptible VMs instance type. To maximize cost savings and market availability, select as many types as possible. Required if instance_types_on_demand is not set.
instance_types_on_demand – (Required) The regular VM instance type to use for mixed-type groups and when falling back to on-demand. Required if instance_types_preemptible is not set.

preemptible_percentage – (Optional) Percentage of Preemptible VMs to spin up from the “desired_capacity“.