Skip to content

Latest commit

 

History

History

eks_nodegroup

eks_nodegroup

Summary

This module provides resources to create and configure EKS nodegroup. EC2 instances of the nodegroups can be of different types (e.g. on-demand and spot) and sizes, and it is possible to deploy application to the specific instance using a nodeGroup selector.

Usage example

  • Creating the on-demand (AWS permanent instance) state.
    The example will look like the following:
module "eks_nodegroup_ondemand" {
  count                                   = local.is_prod_envs
  source                                  = "../modules/eks_nodegroup"
  ami_type                                = "AL2_ARM_64"
  get_instance_type                       = "r6gd.4xlarge"
  user_data_script                        = "nvme-spot.sh"
  get_nodegroup_name                      = "ondemand-mainnet" # don't need to type ondemand/spot in the name, it will be added automatically.
  get_global_configuration                = local.make_global_configuration
  get_eks_nodegroups_global_configuration = local.make_eks_nodegroups_global_configuration
}
  • Creating the spot (AWS temporary instance with discount return back anytime) recent state node.
    The example will look like the following:
module "eks_nodegroup_spot" {
  count                                   = local.is_prod_envs
  source                                  = "../modules/eks_nodegroup"
  get_instance_type                       = "m5d.8xlarge,r5ad.8xlarge"
  get_nodegroup_name                      = "mainnet_slave" # don't need to type ondemand/spot in the name, it will be added automatically.
  get_global_configuration                = local.make_global_configuration
  get_eks_nodegroups_global_configuration = local.make_eks_nodegroups_global_configuration
  is_spot_instance                        = true
}
  • Creating the archive node.
    The example will look like the following:
module "eks_nodegroup_archive" {
  count                                   = local.is_prod_envs
  source                                  = "../modules/eks_nodegroup"
  ami_type                                = "AL2_ARM_64"
  get_instance_type                       = "r6g.12xlarge"
  get_nodegroup_name                      = "archive-node" # don't need to type ondemand/spot in the name, it will be added automatically.
  get_global_configuration                = local.make_global_configuration
  get_eks_nodegroups_global_configuration = local.make_eks_nodegroups_global_configuration
  use_existing_ebs                        = true
  ebs_tenant                              = "space07"
  assign_to_space00_07_nodes              = true
}

Modules

Name Source Version
generator ../../modules/generator n/a

Resources

Name Type
aws_eks_node_group.nodegroup resource
aws_iam_policy.attach_ebs resource
aws_iam_role.eks_nodegroup resource
aws_iam_role_policy_attachment.attach_ebs resource
aws_iam_role_policy_attachment.eks_nodegroup_AmazonEC2ContainerRegistryReadOnly resource
aws_iam_role_policy_attachment.eks_nodegroup_AmazonEKSWorkerNodePolicy resource
aws_iam_role_policy_attachment.eks_nodegroup_AmazonEKS_CNI_Policy resource
aws_key_pair.eks_node resource
aws_launch_template.lt_ondemand resource
aws_launch_template.lt_spot resource
aws_security_group.eks_nogroup_sg resource
aws_security_group_rule.eks_sgr_egress_itself resource
aws_security_group_rule.eks_sgr_egress_nodes resource
aws_security_group_rule.eks_sgr_ingress_endpoint resource
aws_security_group_rule.eks_sgr_ingress_http_endpoint resource
aws_security_group_rule.eks_sgr_ingress_itself resource
aws_security_group_rule.eks_sgr_ingress_ssh resource
random_string.nodegroup_name_postfix resource
aws_subnet.selected data source

Inputs

Name Description Type Default Required
ami_type For on-demand instances used the AWS Graviton2 made Arm-based use the type AMI AL2_ARM_64. For spot instances used default value. string "AL2_x86_64" no
assign_to_space00_07_nodes If value TRUE assign archive pods only on archival nodes. bool false no
availability_zone_postfix Availability zone to deploy the nodegroup to. string "a" no
ebs_tenant Tenant tag value to search EBS volumes by. string null no
get_desired_size Desired number of instances in the scaling group. number 1 no
get_eks_nodegroups_global_configuration Set of basic inputs to EKS cluster and networking settings. any n/a yes
get_global_configuration Set of inputs used by module generator for the naming. any n/a yes
get_instance_type List of instance types associated with the EKS Node Group. Defaults to on-demand [r6gd.4xlarge], to spot [m5d.8xlarge,r5ad.8xlarge] string n/a yes
get_max_size Maximum number of instances in the scaling group. number 2 no
get_min_size Minimum number of instances in the scaling group. number 1 no
get_nodegroup_name Name of the nodegroup. string null no
is_spot_instance If value TRUE run the launch template for spot. bool false no
public_key SSH key that provides access for remote communication with the instances. string "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHMC7lI58Is6qjyARyNAJw9jm/LWcmjXsIZL5t2urMcl common alexey_kulik" no
use_existing_ebs If true, EBS volumes matching ebs_tenant will be attached on launch. bool false no
user_data_script n/a string "nvme.sh" no