or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

alb-controller.mdauth.mdcluster.mdfargate.mdindex.mdkubectl-provider.mdkubernetes-resources.mdnode-groups.mdservice-accounts.mdutilities.md
tile.json

node-groups.mddocs/

Node Groups

Managed and self-managed node group configuration providing scalable compute capacity for EKS clusters with support for multiple instance types, scaling policies, and launch templates.

Capabilities

Nodegroup Class

Managed node group providing automatic lifecycle management by AWS EKS.

/**
 * Managed node group for EKS clusters
 */
class Nodegroup extends Construct implements INodegroup {
  constructor(scope: Construct, id: string, props: NodegroupProps);
  
  /** Node group name */
  readonly nodegroupName: string;
  /** Node group ARN */
  readonly nodegroupArn: string;
  /** Associated EKS cluster */
  readonly cluster: ICluster;
  /** IAM role for the node group */
  readonly role: iam.IRole;
}

/**
 * Node group properties
 */
interface NodegroupProps extends NodegroupOptions {
  /** EKS cluster */
  readonly cluster: ICluster;
}

/**
 * Node group configuration options
 */
interface NodegroupOptions {
  /** Node group name */
  readonly nodegroupName?: string;
  /** Instance types for the node group */
  readonly instanceTypes?: ec2.InstanceType[];
  /** AMI type */
  readonly amiType?: NodegroupAmiType;
  /** Capacity type (On-Demand or Spot) */
  readonly capacityType?: CapacityType;
  /** Disk size in GB */
  readonly diskSize?: number;
  /** IAM role for nodes */
  readonly nodeRole?: iam.IRole;
  /** Minimum number of nodes */
  readonly minSize?: number;
  /** Maximum number of nodes */
  readonly maxSize?: number;
  /** Desired number of nodes */
  readonly desiredSize?: number;
  /** VPC subnets */
  readonly subnets?: ec2.SubnetSelection;
  /** SSH access configuration */
  readonly remoteAccess?: NodegroupRemoteAccess;
  /** Launch template */
  readonly launchTemplateSpec?: LaunchTemplateSpec;
  /** Kubernetes labels */
  readonly labels?: { [key: string]: string };
  /** Kubernetes taints */
  readonly taints?: TaintSpec[];
  /** Update configuration */
  readonly updateConfig?: NodegroupUpdateConfig;
  /** Instance profile name */
  readonly instanceProfile?: string;
  /** Release version */
  readonly releaseVersion?: string;
  /** Kubernetes version */
  readonly version?: KubernetesVersion;
  /** Resource tags */
  readonly tags?: { [key: string]: string };
  /** Force update */
  readonly forceUpdate?: boolean;
}

Usage Examples:

import * as eks from "@aws-cdk/aws-eks";
import * as ec2 from "@aws-cdk/aws-ec2";

// Basic managed node group
const nodegroup = cluster.addNodegroupCapacity("NodeGroup", {
  instanceTypes: [new ec2.InstanceType("t3.medium")],
  minSize: 1,
  maxSize: 5,
  desiredSize: 2,
});

// Advanced node group with spot instances
const spotNodegroup = cluster.addNodegroupCapacity("SpotNodes", {
  instanceTypes: [
    new ec2.InstanceType("t3.medium"),
    new ec2.InstanceType("t3.large"),
  ],
  capacityType: eks.CapacityType.SPOT,
  amiType: eks.NodegroupAmiType.AL2_X86_64,
  diskSize: 50,
  labels: {
    "node-type": "spot",
    "workload": "batch",
  },
  taints: [{
    key: "spot-instance",
    value: "true",
    effect: eks.TaintEffect.NO_SCHEDULE,
  }],
});

Static Methods

/**
 * Import existing node group
 */
static fromNodegroupName(scope: Construct, id: string, nodegroupName: string): INodegroup;

Auto Scaling Group Integration

/**
 * Connect external Auto Scaling Group as cluster capacity
 */
connectAutoScalingGroupCapacity(
  autoScalingGroup: autoscaling.AutoScalingGroup,
  options: AutoScalingGroupOptions
): void;

/**
 * Auto Scaling Group options
 */
interface AutoScalingGroupOptions {
  /** Bootstrap options */
  readonly bootstrapOptions?: BootstrapOptions;
  /** Whether to automatically update the aws-auth ConfigMap */
  readonly autoScalingGroupName?: string;
  /** Machine image type */
  readonly machineImageType?: MachineImageType;
  /** Spot interrupt handler */
  readonly spotInterruptHandler?: boolean;
  /** Map role */
  readonly mapRole?: boolean;
}

/**
 * Bootstrap options for EKS nodes
 */
interface BootstrapOptions {
  /** Additional kubelet arguments */
  readonly kubeletExtraArgs?: string;
  /** Use max pods */
  readonly useMaxPods?: boolean;
  /** Enable Docker bridge */
  readonly enableDockerBridge?: boolean;
  /** Docker config.json */
  readonly dockerConfigJson?: string;
  /** Additional EKS arguments */
  readonly awsApiRetryAttempts?: number;
  /** Container runtime */
  readonly containerRuntime?: ContainerRuntime;
}

/**
 * Auto Scaling Group capacity options for self-managed nodes
 */
interface AutoScalingGroupCapacityOptions extends autoscaling.CommonAutoScalingGroupProps {
  /** Instance type for the Auto Scaling Group */
  readonly instanceType: ec2.InstanceType;
  /** Automatically map IAM instance role to RBAC */
  readonly mapRole?: boolean;
  /** Enable EKS node bootstrapping */
  readonly bootstrapEnabled?: boolean;
  /** EKS node bootstrapping options */
  readonly bootstrapOptions?: BootstrapOptions;
  /** Machine image type */
  readonly machineImageType?: MachineImageType;
  /** Install spot instance interrupt handler */
  readonly spotInterruptHandler?: boolean;
}

Launch Template Configuration

/**
 * Launch template specification
 */
interface LaunchTemplateSpec {
  /** Launch template ID */
  readonly id: string;
  /** Launch template version */
  readonly version?: string;
}

/**
 * Remote access configuration
 */
interface NodegroupRemoteAccess {
  /** EC2 key pair for SSH access */
  readonly ec2SshKey: string;
  /** Source security groups for SSH access */
  readonly sourceSecurityGroups?: ec2.ISecurityGroup[];
}

/**
 * Update configuration
 */
interface NodegroupUpdateConfig {
  /** Maximum number of nodes unavailable during update */
  readonly maxUnavailable?: number;
  /** Maximum percentage of nodes unavailable during update */
  readonly maxUnavailablePercentage?: number;
}

Taints and Labels

/**
 * Kubernetes taint specification
 */
interface TaintSpec {
  /** Taint key */
  readonly key: string;
  /** Taint value */
  readonly value?: string;
  /** Taint effect */
  readonly effect: TaintEffect;
}

/**
 * Taint effects
 */
enum TaintEffect {
  /** Do not schedule new pods */
  NO_SCHEDULE = "NoSchedule",
  /** Prefer not to schedule new pods */
  PREFER_NO_SCHEDULE = "PreferNoSchedule",
  /** Evict existing pods that do not tolerate the taint */
  NO_EXECUTE = "NoExecute"
}

AMI Types

/**
 * Managed node group AMI types
 */
enum NodegroupAmiType {
  /** Amazon Linux 2 (x86_64) */
  AL2_X86_64 = "AL2_x86_64",
  /** Amazon Linux 2 with GPU support (x86_64) */
  AL2_X86_64_GPU = "AL2_x86_64_GPU",
  /** Amazon Linux 2 (ARM64) */
  AL2_ARM_64 = "AL2_ARM_64",
  /** Bottlerocket (ARM64) */
  BOTTLEROCKET_ARM_64 = "BOTTLEROCKET_ARM_64",
  /** Bottlerocket (x86_64) */
  BOTTLEROCKET_X86_64 = "BOTTLEROCKET_x86_64"
}

/**
 * Capacity type
 */
enum CapacityType {
  /** Spot instances */
  SPOT = "SPOT",
  /** On-Demand instances */
  ON_DEMAND = "ON_DEMAND"
}

Machine Images

/**
 * EKS-optimized AMI for worker nodes
 */
class EksOptimizedImage implements ec2.IMachineImage {
  constructor(props?: EksOptimizedImageProps);
  
  /** Get machine image configuration */
  getImage(scope: Construct): ec2.MachineImageConfig;
}

/**
 * EKS-optimized AMI properties
 */
interface EksOptimizedImageProps {
  /** Kubernetes version */
  readonly kubernetesVersion?: string;
  /** Node type */
  readonly nodeType?: NodeType;
  /** CPU architecture */
  readonly cpuArch?: CpuArch;
}

/**
 * EKS node instance types
 */
enum NodeType {
  /** Standard instances */
  STANDARD = "Standard",
  /** GPU instances */
  GPU = "GPU",
  /** Inferentia instances */
  INFERENTIA = "Inferentia"
}

/**
 * CPU architecture
 */
enum CpuArch {
  /** ARM64 architecture */
  ARM_64 = "arm64",
  /** x86_64 architecture */
  X86_64 = "x86_64"
}