NodegroupProps Struct
NodeGroup properties interface.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_eks as eks } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
declare const cluster: eks.Cluster;
declare const instanceType: ec2.InstanceType;
declare const role: iam.Role;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
const nodegroupProps: eks.NodegroupProps = {
cluster: cluster,
// the properties below are optional
amiType: eks.NodegroupAmiType.AL2_X86_64,
capacityType: eks.CapacityType.SPOT,
desiredSize: 123,
diskSize: 123,
enableNodeAutoRepair: false,
forceUpdate: false,
instanceTypes: [instanceType],
labels: {
labelsKey: 'labels',
},
launchTemplateSpec: {
id: 'id',
// the properties below are optional
version: 'version',
},
maxSize: 123,
maxUnavailable: 123,
maxUnavailablePercentage: 123,
minSize: 123,
nodegroupName: 'nodegroupName',
nodeRole: role,
releaseVersion: 'releaseVersion',
remoteAccess: {
sshKeyName: 'sshKeyName',
// the properties below are optional
sourceSecurityGroups: [securityGroup],
},
removalPolicy: cdk.RemovalPolicy.DESTROY,
subnets: {
availabilityZones: ['availabilityZones'],
onePerAz: false,
subnetFilters: [subnetFilter],
subnetGroupName: 'subnetGroupName',
subnets: [subnet],
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
},
tags: {
tagsKey: 'tags',
},
taints: [{
effect: eks.TaintEffect.NO_SCHEDULE,
key: 'key',
value: 'value',
}],
};
Properties
amiTypeoptionalNodegroupAmiTypeami_typeoptionalNodegroupAmiTypeamiTypeoptionalNodegroupAmiTypeAmiTypeoptionalNodegroupAmiTypeAmiTypeoptionalNodegroupAmiType#Default: auto-determined from the instanceTypes property when launchTemplateSpec property is not specified
If you explicitly specify the launchTemplate with custom AMI, do not specify this property, or the node group deployment will fail. In other cases, you will need to specify correct amiType for the nodegroup.
capacityTypeoptionalCapacityTypecapacity_typeoptionalCapacityTypecapacityTypeoptionalCapacityTypeCapacityTypeoptionalCapacityTypeCapacityTypeoptionalCapacityType= ON_DEMAND#desiredSizeoptionalnumberdesired_sizeoptionalint | floatdesiredSizeoptionalNumberDesiredSizeoptionaldoubleDesiredSizeoptional*float64= 2#If not specified, the nodewgroup will initially create minSize instances.
diskSizeoptionalnumberdisk_sizeoptionalint | floatdiskSizeoptionalNumberDiskSizeoptionaldoubleDiskSizeoptional*float64= 20#enableNodeAutoRepairoptionalbooleanenable_node_auto_repairoptionalboolenableNodeAutoRepairoptionalBooleanEnableNodeAutoRepairoptionalboolEnableNodeAutoRepairoptional*bool= disabled#Node auto repair is disabled by default.
forceUpdateoptionalbooleanforce_updateoptionalboolforceUpdateoptionalBooleanForceUpdateoptionalboolForceUpdateoptional*bool= true#If an update fails because pods could not be drained, you can force the update after it fails to terminate the old node whether or not any pods are running on the node.
instanceTypesoptionalInstanceType[]instance_typesoptionaltyping.List[InstanceType]instanceTypesoptionalList<InstanceType>InstanceTypesoptionalInstanceType[]InstanceTypesoptional*[]InstanceType#Default: t3.medium will be used according to the cloudformation document.
labelsoptional{ [key: string]: string }labelsoptionaltyping.Mapping[str, str]labelsoptionalMap<String, String>LabelsoptionalIDictionary<string, string>Labelsoptional*map[string]*string= None#launchTemplateSpecoptionalLaunchTemplateSpeclaunch_template_specoptionalLaunchTemplateSpeclaunchTemplateSpecoptionalLaunchTemplateSpecLaunchTemplateSpecoptionalLaunchTemplateSpecLaunchTemplateSpecoptionalLaunchTemplateSpec#Default: no launch template
maxSizeoptionalnumbermax_sizeoptionalint | floatmaxSizeoptionalNumberMaxSizeoptionaldoubleMaxSizeoptional*float64= desiredSize#Managed node groups can support up to 100 nodes by default.
minSizeoptionalnumbermin_sizeoptionalint | floatminSizeoptionalNumberMinSizeoptionaldoubleMinSizeoptional*float64= 1#This number must be greater than or equal to zero.
nodegroupNameoptionalstringnodegroup_nameoptionalstrnodegroupNameoptionalStringNodegroupNameoptionalstringNodegroupNameoptional*string#Default: resource ID
nodeRoleoptionalIRolenode_roleoptionalIRolenodeRoleoptionalIRoleNodeRoleoptionalIRoleNodeRoleoptionalIRole#Default: None. Auto-generated if not specified.
notes
The Amazon EKS worker node kubelet daemon makes calls to AWS APIs on your behalf. Worker nodes receive permissions for these API calls through an IAM instance profile and associated policies. Before you can launch worker nodes and register them into a cluster, you must create an IAM role for those worker nodes to use when they are launched.
releaseVersionoptionalstringrelease_versionoptionalstrreleaseVersionoptionalStringReleaseVersionoptionalstringReleaseVersionoptional*string#Default: The latest available AMI version for the node group's current Kubernetes version is used.
remoteAccessoptionalNodegroupRemoteAccessremote_accessoptionalNodegroupRemoteAccessremoteAccessoptionalNodegroupRemoteAccessRemoteAccessoptionalNodegroupRemoteAccessRemoteAccessoptionalNodegroupRemoteAccess= disabled#Disabled by default, however, if you specify an Amazon EC2 SSH key but do not specify a source security group when you create a managed node group, then port 22 on the worker nodes is opened to the internet (0.0.0.0/0)
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.DESTROY#notes
The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations:
- The resource is removed from the template, so CloudFormation stops managing it
- A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
- The stack is deleted, so CloudFormation stops managing all resources in it
subnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionsubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelectionSubnetsoptionalSubnetSelection#Default: private subnets
By specifying the SubnetSelection, the selected subnets will automatically apply required tags i.e. kubernetes.io/cluster/CLUSTER_NAME with a value of shared, where CLUSTER_NAME is replaced with the name of your cluster.
tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string= None#Each tag consists of a key and an optional value, both of which you define. Node group tags do not propagate to any other resources associated with the node group, such as the Amazon EC2 instances or subnets.