Spotinst Terraform Module to integrate existing k8s node groups with Ocean launchspec/Virtual Node group (VNG)
Note: This module will automatically import any tags defined in the AWS provider default_tags
provider "spotinst" {
token = "redacted"
account = "redacted"
}
module "ocean-aws-k8s" {
...
}
## Create Ocean Virtual Node Group (launchspec) ##
module "ocean-aws-k8s-vng_stateless" {
source = "spotinst/ocean-aws-k8s-vng/spotinst"
name = "stateless" # Name of VNG in Ocean
ocean_id = module.ocean-aws-k8s.ocean_id
#ami_id = "" # Can change the AMI
labels = [{key="type",value="stateless"}]
}
## Create additional Ocean Virtual Node Group (launchspec) ##
module "ocean-aws-k8s-vng_gpu" {
source = "spotinst/ocean-aws-k8s-vng/spotinst"
name = "gpu" # Name of VNG in Ocean
ocean_id = module.ocean-aws-k8s.ocean_id
labels = [{key="type",value="gpu"}]
taints = [{key="type",value="gpu",effect="NoSchedule"}]
#instance_types = ["g4dn.xlarge","g4dn.2xlarge"] # Limit VNG to specific instance types
spot_percentage = 50 # Change the spot %
}
## Create Ocean Virtual Node Group (launchSpec) with instance_type_filters ##
module "ocean-aws-k8s-vng" {
source = "spotinst/ocean-aws-k8s-vng/spotinst"
ocean_id = module.ocean-aws-k8s.ocean_id
name = "test-vng"
instance_types_filters_enable = true
instance_types_filters_categories = ["Accelerated_computing", "Compute_optimized"]
instance_types_filters_disk_types = ["NVMe", "EBS"]
instance_types_filters_exclude_families = ["t2","R4*"]
instance_types_filters_exclude_metal = true
instance_types_filters_hypervisor = ["nitro"]
instance_types_filters_include_families = ["c5*", "g5"]
instance_types_filters_is_ena_supported = true
instance_types_filters_max_gpu = 4
instance_types_filters_min_gpu = 0
instance_types_filters_max_memory_gib = 16
instance_types_filters_max_network_performance = 20
instance_types_filters_max_vcpu = 16
instance_types_filters_min_enis = 2
instance_types_filters_min_memory_gib = 8
instance_types_filters_min_network_performance = 2
instance_types_filters_min_vcpu = 2
instance_types_filters_root_device_types = ["ebs"]
instance_types_filters_virtualization_types = ["hvm"]
images = [{image_id="ami-123456"},{image_id="ami-67890"}]
block_device_mappings = [{
device_name = "/dev/xvda"
encrypted = false
volume_type = "gp3"
}]
dynamic_volume_size = {
base_size = 50
resource = "CPU"
size_per_resource_unit = 20
}
ephemeral_storage_device_name = "/dev/xvdb"
}
~> You must configure the spotinst_ocean_aws
resource. Ensure spotinst_ocean_aws
resource (defined in ocean-aws-k8s
module) is defined before this module as the ocean_id
is needed.
Name | Version |
---|---|
spotinst/spotinst | >= 1.95 |
ocean-aws-k8s
- Creates Ocean Cluster Dococean-controller
- Create and installs spot ocean controller pod Dococean-aws-k8s-vng
- (Optional) Add custom virtual node groups Doc
If you're new to Spot and want to get started, please checkout our Getting Started guide, available on the Spot Documentation website.
We use GitHub issues for tracking bugs and feature requests. Please use these community resources for getting help:
- Ask a question on Stack Overflow and tag it with terraform-spotinst.
- Join our Spot community on Slack.
- Open an issue.
Please see the contribution guidelines.
Name | Type |
---|---|
ocean-aws-k8s-vng | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ocean_id | The Ocean cluster identifier. Required for Launch Spec creation. | string |
null |
yes |
name | Set launch specification name. | string |
null |
no |
instance_types_filters_enable | 'instance_types_filters_enable' to be set to true to have instance_types_filters configured in the virtual node group. | boolean |
null |
no |
instance_types_filters | The instance types that match with all filters compose the Virtual Node Group's instanceTypes parameter. The architectures that come from the Virtual Node Group's images will be taken into account when using this parameter. Cannot be configured together with Virtual Node Group's instanceTypes and with the Cluster's whitelist/blacklist/filters. | object({ |
null |
no |
images | You can configure VNG with either the imageId or images objects, but not both simultaneously. For each architecture type (amd64, arm64) only one AMI is allowed. Valid values: null, or an array with at least one element. |
list(object({ |
null |
no |
block_device_mappings | block_device_mapping object | list(object({ |
[] |
no |
dynamic_volume_size | dynamic_volume_size object | object({ |
null |
no |
ephemeral_storage_device_name | ephemeral_storage_device_name | string |
null |
no |
Name | Description |
---|---|
virtual_node_group_id | The virtual node group ID |