Method: Aws::EKS::Client#create_nodegroup
- Defined in:
- lib/aws-sdk-eks/client.rb
#create_nodegroup(params = {}) ⇒ Types::CreateNodegroupResponse
Creates a managed node group for an Amazon EKS cluster.
You can only create a node group for your cluster that is equal to the current Kubernetes version for the cluster. All node groups are created with the latest AMI release version for the respective minor Kubernetes version of the cluster, unless you deploy a custom AMI using a launch template.
For later updates, you will only be able to update a node group using a launch template only if it was originally deployed with a launch template. Additionally, the launch template ID or name must match what was used when the node group was created. You can update the launch template version with necessary changes. For more information about using launch templates, see [Customizing managed nodes with launch templates].
An Amazon EKS managed node group is an Amazon EC2 Auto Scaling group and associated Amazon EC2 instances that are managed by Amazon Web Services for an Amazon EKS cluster. For more information, see [Managed node groups] in the *Amazon EKS User Guide*.
<note markdown=“1”> Windows AMI types are only supported for commercial Amazon Web Services Regions that support Windows on Amazon EKS.
</note>
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html [2]: docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
resp = client.create_nodegroup({
cluster_name: "String", # required
nodegroup_name: "String", # required
scaling_config: {
min_size: 1,
max_size: 1,
desired_size: 1,
},
disk_size: 1,
subnets: ["String"], # required
instance_types: ["String"],
ami_type: "AL2_x86_64", # accepts AL2_x86_64, AL2_x86_64_GPU, AL2_ARM_64, CUSTOM, BOTTLEROCKET_ARM_64, BOTTLEROCKET_x86_64, BOTTLEROCKET_ARM_64_FIPS, BOTTLEROCKET_x86_64_FIPS, BOTTLEROCKET_ARM_64_NVIDIA, BOTTLEROCKET_x86_64_NVIDIA, WINDOWS_CORE_2019_x86_64, WINDOWS_FULL_2019_x86_64, WINDOWS_CORE_2022_x86_64, WINDOWS_FULL_2022_x86_64, AL2023_x86_64_STANDARD, AL2023_ARM_64_STANDARD, AL2023_x86_64_NEURON, AL2023_x86_64_NVIDIA, AL2023_ARM_64_NVIDIA
remote_access: {
ec2_ssh_key: "String",
source_security_groups: ["String"],
},
node_role: "String", # required
labels: {
"labelKey" => "labelValue",
},
taints: [
{
key: "taintKey",
value: "taintValue",
effect: "NO_SCHEDULE", # accepts NO_SCHEDULE, NO_EXECUTE, PREFER_NO_SCHEDULE
},
],
tags: {
"TagKey" => "TagValue",
},
client_request_token: "String",
launch_template: {
name: "String",
version: "String",
id: "String",
},
update_config: {
max_unavailable: 1,
max_unavailable_percentage: 1,
update_strategy: "DEFAULT", # accepts DEFAULT, MINIMAL
},
node_repair_config: {
enabled: false,
},
capacity_type: "ON_DEMAND", # accepts ON_DEMAND, SPOT, CAPACITY_BLOCK
version: "String",
release_version: "String",
})
Response structure
Response structure
resp.nodegroup.nodegroup_name #=> String
resp.nodegroup.nodegroup_arn #=> String
resp.nodegroup.cluster_name #=> String
resp.nodegroup.version #=> String
resp.nodegroup.release_version #=> String
resp.nodegroup.created_at #=> Time
resp.nodegroup.modified_at #=> Time
resp.nodegroup.status #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATE_FAILED", "DELETE_FAILED", "DEGRADED"
resp.nodegroup.capacity_type #=> String, one of "ON_DEMAND", "SPOT", "CAPACITY_BLOCK"
resp.nodegroup.scaling_config.min_size #=> Integer
resp.nodegroup.scaling_config.max_size #=> Integer
resp.nodegroup.scaling_config.desired_size #=> Integer
resp.nodegroup.instance_types #=> Array
resp.nodegroup.instance_types[0] #=> String
resp.nodegroup.subnets #=> Array
resp.nodegroup.subnets[0] #=> String
resp.nodegroup.remote_access.ec2_ssh_key #=> String
resp.nodegroup.remote_access.source_security_groups #=> Array
resp.nodegroup.remote_access.source_security_groups[0] #=> String
resp.nodegroup.ami_type #=> String, one of "AL2_x86_64", "AL2_x86_64_GPU", "AL2_ARM_64", "CUSTOM", "BOTTLEROCKET_ARM_64", "BOTTLEROCKET_x86_64", "BOTTLEROCKET_ARM_64_FIPS", "BOTTLEROCKET_x86_64_FIPS", "BOTTLEROCKET_ARM_64_NVIDIA", "BOTTLEROCKET_x86_64_NVIDIA", "WINDOWS_CORE_2019_x86_64", "WINDOWS_FULL_2019_x86_64", "WINDOWS_CORE_2022_x86_64", "WINDOWS_FULL_2022_x86_64", "AL2023_x86_64_STANDARD", "AL2023_ARM_64_STANDARD", "AL2023_x86_64_NEURON", "AL2023_x86_64_NVIDIA", "AL2023_ARM_64_NVIDIA"
resp.nodegroup.node_role #=> String
resp.nodegroup.labels #=> Hash
resp.nodegroup.labels["labelKey"] #=> String
resp.nodegroup.taints #=> Array
resp.nodegroup.taints[0].key #=> String
resp.nodegroup.taints[0].value #=> String
resp.nodegroup.taints[0].effect #=> String, one of "NO_SCHEDULE", "NO_EXECUTE", "PREFER_NO_SCHEDULE"
resp.nodegroup.resources.auto_scaling_groups #=> Array
resp.nodegroup.resources.auto_scaling_groups[0].name #=> String
resp.nodegroup.resources.remote_access_security_group #=> String
resp.nodegroup.disk_size #=> Integer
resp.nodegroup.health.issues #=> Array
resp.nodegroup.health.issues[0].code #=> String, one of "AutoScalingGroupNotFound", "AutoScalingGroupInvalidConfiguration", "Ec2SecurityGroupNotFound", "Ec2SecurityGroupDeletionFailure", "Ec2LaunchTemplateNotFound", "Ec2LaunchTemplateVersionMismatch", "Ec2SubnetNotFound", "Ec2SubnetInvalidConfiguration", "IamInstanceProfileNotFound", "Ec2SubnetMissingIpv6Assignment", "IamLimitExceeded", "IamNodeRoleNotFound", "NodeCreationFailure", "AsgInstanceLaunchFailures", "InstanceLimitExceeded", "InsufficientFreeAddresses", "AccessDenied", "InternalFailure", "ClusterUnreachable", "AmiIdNotFound", "AutoScalingGroupOptInRequired", "AutoScalingGroupRateLimitExceeded", "Ec2LaunchTemplateDeletionFailure", "Ec2LaunchTemplateInvalidConfiguration", "Ec2LaunchTemplateMaxLimitExceeded", "Ec2SubnetListTooLong", "IamThrottling", "NodeTerminationFailure", "PodEvictionFailure", "SourceEc2LaunchTemplateNotFound", "LimitExceeded", "Unknown", "AutoScalingGroupInstanceRefreshActive", "KubernetesLabelInvalid", "Ec2LaunchTemplateVersionMaxLimitExceeded", "Ec2InstanceTypeDoesNotExist"
resp.nodegroup.health.issues[0].message #=> String
resp.nodegroup.health.issues[0].resource_ids #=> Array
resp.nodegroup.health.issues[0].resource_ids[0] #=> String
resp.nodegroup.update_config.max_unavailable #=> Integer
resp.nodegroup.update_config.max_unavailable_percentage #=> Integer
resp.nodegroup.update_config.update_strategy #=> String, one of "DEFAULT", "MINIMAL"
resp.nodegroup.node_repair_config.enabled #=> Boolean
resp.nodegroup.launch_template.name #=> String
resp.nodegroup.launch_template.version #=> String
resp.nodegroup.launch_template.id #=> String
resp.nodegroup.tags #=> Hash
resp.nodegroup.tags["TagKey"] #=> String
Parameters:
-
params
(Hash)
(defaults to: {})
—
({})
Options Hash (params):
-
:cluster_name
(required, String)
—
The name of your cluster.
-
:nodegroup_name
(required, String)
—
The unique name to give your node group.
-
:scaling_config
(Types::NodegroupScalingConfig)
—
The scaling configuration details for the Auto Scaling group that is created for your node group.
-
:disk_size
(Integer)
—
The root device disk size (in GiB) for your node group instances. The default disk size is 20 GiB for Linux and Bottlerocket. The default disk size is 50 GiB for Windows. If you specify ‘launchTemplate`, then don’t specify ‘diskSize`, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see
- Customizing managed nodes with launch templates][1
-
in the *Amazon
EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:subnets
(required, Array<String>)
—
The subnets to use for the Auto Scaling group that is created for your node group. If you specify ‘launchTemplate`, then don’t specify ‘ SubnetId ` in your launch template, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:instance_types
(Array<String>)
—
Specify the instance types for a node group. If you specify a GPU instance type, make sure to also specify an applicable GPU AMI type with the ‘amiType` parameter. If you specify `launchTemplate`, then you can specify zero or one instance type in your launch template or you can specify 0-20 instance types for `instanceTypes`. If however, you specify an instance type in your launch template and specify any `instanceTypes`, the node group deployment will fail. If you don’t specify an instance type in a launch template or for ‘instanceTypes`, then `t3.medium` is used, by default. If you specify `Spot` for `capacityType`, then we recommend specifying multiple values for `instanceTypes`. For more information, see [Managed node group capacity types] and [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types [2]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:ami_type
(String)
—
The AMI type for your node group. If you specify ‘launchTemplate`, and your launch template uses a custom AMI, then don’t specify ‘amiType`, or the node group deployment will fail. If your launch template uses a Windows custom AMI, then add `eks:kube-proxy-windows` to your Windows nodes `rolearn` in the `aws-auth` `ConfigMap`. For more information about using launch templates with Amazon EKS, see [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:remote_access
(Types::RemoteAccessConfig)
—
The remote access configuration to use with your node group. For Linux, the protocol is SSH. For Windows, the protocol is RDP. If you specify ‘launchTemplate`, then don’t specify ‘remoteAccess`, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:node_role
(required, String)
—
The Amazon Resource Name (ARN) of the IAM role to associate with your node group. The Amazon EKS worker node ‘kubelet` daemon makes calls to Amazon Web Services APIs on your behalf. Nodes receive permissions for these API calls through an IAM instance profile and associated policies. Before you can launch nodes and register them into a cluster, you must create an IAM role for those nodes to use when they are launched. For more information, see [Amazon EKS node IAM role] in the Amazon EKS User Guide . If you specify `launchTemplate`, then don’t specify ‘ IamInstanceProfile ` in your launch template, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see
- Customizing managed nodes with launch templates][2
-
in the *Amazon
EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/create-node-role.html [2]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:labels
(Hash<String,String>)
—
The Kubernetes ‘labels` to apply to the nodes in the node group when they are created.
-
:taints
(Array<Types::Taint>)
—
The Kubernetes taints to be applied to the nodes in the node group. For more information, see [Node taints on managed node groups].
[1]: docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html
-
:tags
(Hash<String,String>)
—
Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don’t propagate to any other cluster or Amazon Web Services resources.
-
:client_request_token
(String)
—
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
**A suitable default value is auto-generated.** You should normally not need to pass this option.**
-
:launch_template
(Types::LaunchTemplateSpecification)
—
An object representing a node group’s launch template specification. When using this object, don’t directly specify ‘instanceTypes`, `diskSize`, or `remoteAccess`. You cannot later specify a different launch template ID or name than what was used to create the node group.
Make sure that the launch template meets the requirements in ‘launchTemplateSpecification`. Also refer to [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:update_config
(Types::NodegroupUpdateConfig)
—
The node group update configuration.
-
:node_repair_config
(Types::NodeRepairConfig)
—
The node auto repair configuration for the node group.
-
:capacity_type
(String)
—
The capacity type for your node group.
-
:version
(String)
—
The Kubernetes version to use for your managed nodes. By default, the Kubernetes version of the cluster is used, and this is the only accepted specified value. If you specify ‘launchTemplate`, and your launch template uses a custom AMI, then don’t specify ‘version`, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
-
:release_version
(String)
—
The AMI version of the Amazon EKS optimized AMI to use with your node group. By default, the latest available AMI version for the node group’s current Kubernetes version is used. For information about Linux versions, see [Amazon EKS optimized Amazon Linux AMI versions] in the *Amazon EKS User Guide*. Amazon EKS managed node groups support the November 2022 and later releases of the Windows AMIs. For information about Windows versions, see [Amazon EKS optimized Windows AMI versions] in the *Amazon EKS User Guide*.
If you specify ‘launchTemplate`, and your launch template uses a custom AMI, then don’t specify ‘releaseVersion`, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see [Customizing managed nodes with launch templates] in the *Amazon EKS User Guide*.
[1]: docs.aws.amazon.com/eks/latest/userguide/eks-linux-ami-versions.html [2]: docs.aws.amazon.com/eks/latest/userguide/eks-ami-versions-windows.html [3]: docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
Returns:
-
(Types::CreateNodegroupResponse)
—
Returns a response object which responds to the following methods:
-
#nodegroup => Types::Nodegroup
-
See Also:
1971 1972 1973 1974 |
# File 'lib/aws-sdk-eks/client.rb', line 1971 def create_nodegroup(params = {}, options = {}) req = build_request(:create_nodegroup, params) req.send_request(options) end |