-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-eks): managed nodegroup for spot instances #11827
Comments
@pahud I actually think this should be part of the core library, its definitely an important capability and we should provide an experience as easy as I think we can start with enabling this via the current const spots = new eks.SpotLaunchTemplateSpec(...);
new eks.Nodegroup(this, 'SpotNodeGroup', {
...,
launchTemplateSpec: spots,
}) When we introduce proper const spots = new eks.SpotLaunchTemplate(...); // will now extend `ec2.LaunchTemplate`.
new eks.Nodegroup(this, 'SpotNodeGroup', {
...,
launchTemplate: spots,
}) Thoughts? |
@iliapolo Yes. That will be easier. Please leave this PR for me. I'll do it in the next few days. |
@pahud Let's have another API discussion here before you actually start coding? still feels a little awkward to me even though the approach is solid. |
@iliapolo @pahud FWIW, it would be great if the high level api for the cluster just allowed something similar to:
Interacting with launch templates seems like an advanced concept that isn't needed for the simple case of just adding more capacity. |
Hi @iliapolo I have yet to start coding. Please let me know what's in your mind. RE @abierbaum I believe there would be some scenarios for the EKS with Spot instances integration:
Same as above. But only on-demand single instance type.
According to Considerations for selecting a capacity type:
To achieve this, we'll need to bake the launch template for the nodegroup, which would be a little bit challenging. Good to hide it behind the construct. Given this, I think we probably can design the Nodegroup API like this cluster.addNodeGroup(scope, id, {
capacityType: CapacityType.SPOT,
instanceTypes: InstanceType[],
}) or simply cluster.addNodeGroup(scope, id, {
spot: true,
instanceTypes: InstanceType[],
}) And we create the nodegroup and bake the LT with custom resource. WDYT? |
this is weird
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html If cfn can support this, that would be easier for implementation in cdk. |
This PR adds the `CapacityType` support and allows users to create Spot managed node groups for Amazon EKS. 1. The `CapacityType` attribute is supported by cloudformation but not yet documented. We tentatively use addPropertyOverride() to enable it. 2. `instanceType` will be deprecated and we introduced the new `instanceTypes` 3. `instanceTypes` with different CPU architectures will throw an error. 4. `amiType` is still optional, however, when specified, incorrect `amiType` will throw the error. 5. According to the [document](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-instancetypes), we are allowed to specify instance type(s) in either `instanceTypes` property or launch template but not both. As we can't check the content of the launch template passed in, we allow `instanceTypes` and launch template both specified and encourage to use `instanceTypes` when possible. ## Sample ```ts cluster.addNodegroupCapacity('extra-ng-spot', { instanceTypes: [ new ec2.InstanceType('c5.large'), new ec2.InstanceType('c5a.large'), new ec2.InstanceType('c5d.large'), ], minSize: 3, capacityType: eks.CapacityType.SPOT, }); ``` Closes #11827 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
This PR adds the `CapacityType` support and allows users to create Spot managed node groups for Amazon EKS. 1. The `CapacityType` attribute is supported by cloudformation but not yet documented. We tentatively use addPropertyOverride() to enable it. 2. `instanceType` will be deprecated and we introduced the new `instanceTypes` 3. `instanceTypes` with different CPU architectures will throw an error. 4. `amiType` is still optional, however, when specified, incorrect `amiType` will throw the error. 5. According to the [document](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-instancetypes), we are allowed to specify instance type(s) in either `instanceTypes` property or launch template but not both. As we can't check the content of the launch template passed in, we allow `instanceTypes` and launch template both specified and encourage to use `instanceTypes` when possible. ## Sample ```ts cluster.addNodegroupCapacity('extra-ng-spot', { instanceTypes: [ new ec2.InstanceType('c5.large'), new ec2.InstanceType('c5a.large'), new ec2.InstanceType('c5d.large'), ], minSize: 3, capacityType: eks.CapacityType.SPOT, }); ``` Closes aws#11827 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Amazon EKS now supports provisioning and managing EC2 Spot Instances in managed node groups
https://aws.amazon.com/tw/blogs/containers/amazon-eks-now-supports-provisioning-and-managing-ec2-spot-instances-in-managed-node-groups/
eksctl
just introduced the new--spot
flag which seems to create a new launch template with spot options and pass this template to create the spot-only nodegroup.I was wondering how to create similar experience with
aws-eks
. The Nodegroup L2 construct actually can accept the launch template as the construct property, however, users need to bake their own LT with spot options before they can pass it toNodegroupProps
. It doesn't make sense to add a newspot
property forNodegroupProps
as this is actually a high level abstraction, but making people easily create spot nodegroup with CDK is really helpful.Some options:
aws-eks-patterns
L3 and makeSpotNodegroup
a L3 constructcdk-eks-spot-nodegroup
I'd vote option 1.
@iliapolo wdyt?
ref: https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: