You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-45Lines changed: 38 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,8 +207,9 @@ You'll need the following AWS infrastructure components:
207
207
208
208
1. Amazon Simple Queue Service (SQS) Queue
209
209
2. AutoScaling Group Termination Lifecycle Hook
210
-
3. Amazon EventBridge Rule
211
-
4. IAM Role for the aws-node-termination-handler Queue Processing Pods
210
+
3. Instance Tagging
211
+
4. Amazon EventBridge Rule
212
+
5. IAM Role for the aws-node-termination-handler Queue Processing Pods
212
213
213
214
Optional AWS infrastructure components:
214
215
1. AutoScaling Group Launch Lifecycle Hook
@@ -262,9 +263,7 @@ There are some caveats when using [server side encryption with SQS](https://docs
262
263
263
264
#### 2. Create an ASG Termination Lifecycle Hook:
264
265
265
-
##### 2.1. Send Notification via EventBridge
266
-
267
-
This will configure ASG to send termination notifications to EventBridge.
266
+
Here is the AWS CLI command to create a termination lifecycle hook on an existing ASG when using EventBridge, although this should really be configured via your favorite infrastructure-as-code tool like CloudFormation or Terraform:
This will configure ASG to send termination notifications directly to an SQS queue monitored by NTH.
277
+
If you want to avoid using EventBridge and instead send ASG Lifecycle events directly to SQS, instead use the following command, using the ARNs from Step 1:
If [Capacity Rebalance](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) is configured for your ASG, a new instance will be launched before another's termination. The use of an ASG launch lifecycle hook, as configured below, can verify the new instance has successfully connected as a Kubernetes node.
296
-
297
-
##### 3.1. Send Notification via EventBridge
298
-
299
-
This will configure ASG to send launch notifications to EventBridge.
When NTH receives a launch notification, it will periodically check for a node backed by the EC2 instance to join the cluster and for the node to have a status of 'ready.' Once a node becomes ready, NTH will complete the lifecycle hook, prompting the ASG to proceed with terminating the previous instance. If the lifecycle hook is not completed before the timeout, the ASG will take the default action. If the default action is 'ABANDON,' the new instance will be terminated, and the notification process will be repeated with another new instance.
326
-
327
-
#### 4. Tag the Instances:
290
+
#### 3. Tag the Instances:
328
291
329
292
By default the aws-node-termination-handler will only manage terminations for instances tagged with `key=aws-node-termination-handler/managed`.
330
293
The value of the key does not matter.
@@ -350,7 +313,7 @@ You can also control what resources NTH manages by adding the resource ARNs to y
350
313
351
314
Take a look at the docs on how to [create rules that only manage certain ASGs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/cloud-watch-events.html), and read about all the [supported ASG events](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-event-reference.html).
352
315
353
-
#### 5. Create Amazon EventBridge Rules
316
+
#### 4. Create Amazon EventBridge Rules
354
317
355
318
You may skip this step if sending events from ASG to SQS directly.
NTH can monitor for new instances launched by an ASG and notify the ASG when the instance is available in the EKS cluster.
397
+
398
+
NTH will need to receive notifications of new instance launches within the ASG. We can add a lifecycle hook to the ASG that will send instance launch notifications via EventBridge:
When NTH receives a launch notification, it will periodically check for a node backed by the EC2 instance to join the cluster and for the node to have a status of 'ready.' Once a node becomes ready, NTH will complete the lifecycle hook, prompting the ASG to proceed with terminating the previous instance. If the lifecycle hook is not completed before the timeout, the ASG will take the default action. If the default action is 'ABANDON', the new instance will be terminated, and the notification process will be repeated with another new instance.
0 commit comments