-
Notifications
You must be signed in to change notification settings - Fork 28
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
Using lifecycle-manager with spot instances #65
Comments
lifecycle-manager currently does not support spot termination events. We are open to PRs that can achieve spot termination handling. In the meanwhile you can run https://github.com/aws/aws-node-termination-handler as a daemonset to achieve this. |
Thank you for the response between we can customize the target using target with input transformer as screenshot attached |
https://github.com/aws/aws-node-termination-handler, does not solve this issue, it potentially can cause other problems because it cordons a node and the k8s service controller removes it immediately from ELB without draining it first, it can drop inflight requests. I did a little POC and used the input transformer in the AWS event bridge, translating ec2 spot interruption event to the event sent by a lifecycle hook in ASG input path: {"id":"$.id","instance":"$.detail.instance-id","time":"$.time"} input template: {
"LifecycleHookName": "lifecycle-manager",
"AccountId": "YOUR_ACCOUNT_ID",
"RequestId": <id>,
"LifecycleTransition": "autoscaling:EC2_INSTANCE_TERMINATING",
"AutoScalingGroupName": "ASG_NAME",
"Service": "AWS Auto Scaling",
"Time": <time>,
"EC2InstanceId": <instance>,
"LifecycleActionToken": "CHECK_TOKEN_FROM_THE_ORIGINAL_EVENT"
} lifecycle manage was actually able to parse this and rejected this
obviously, this deletion can cause an issue, if you running multiple clusters with multiple lifecycle managers, as a dumb solution I would just try to stream this spot event to multiple queues, and let each lifecycle manager handle its own queue |
@yuri-1987 interesting solution with transforming the spot event to a lifecycle hook event. I think if you are able to send the correct termination event early enough it would be processed and drained/excluded from ELB. If the instance is already terminated by the time lifecycle-manager gets the event it would reject it as above. |
Hi @eytan-avisror, sorry for not getting back earlier, so this is a log from that spot event. I assume that 120 seconds are not enough for the lifecycle manager to handle this
|
Is this a BUG REPORT or FEATURE REQUEST?:
May be bug or some workaround needed
What happened:
Not working while during spot instance termination.
Also checked this #18 (comment).
Is it possible to do with Input Transformer?
What you expected to happen:
Should or work around to deal with spot instance termination event
How to reproduce it (as minimally and precisely as possible):
Create spot instance ASG and wait for the termination from the AWS
Environment:
lifecycle-manager version: 0.4.0
Kubernetes version: v1.17
relevant logs:
Seeing the logs when the spot interrupt event occurs
level=warning msg="got unsupported event type: ''"
The text was updated successfully, but these errors were encountered: