Skip to content

Commit 62ad799

Browse files
authored
Update interruption-handling.md
Improve readability
1 parent c023ab7 commit 62ad799

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

designs/interruption-handling.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ There are two ways in-which Spot interruption notifications and Rebalance Recomm
2929
EC2 IMDS is an HTTP API that can only be locally accessed from an EC2 instance.
3030

3131
```
32-
`curl 169.254.169.254/latest/meta-data/spot/instance-action
32+
# Termination Check
33+
curl 169.254.169.254/latest/meta-data/spot/instance-action
3334
{
3435
"action": "terminate",
3536
"time": "2022-07-11T17:11:44Z"
3637
}
3738
38-
curl 169.254.169.254``/``latest``/``meta``-``data``/``events``/``recommendations``/``rebalance`
39-
`{`
40-
` ``"noticeTime"``:`` ``"2022-07-16T19:18:24Z"`
39+
# Rebalance Check
40+
curl 169.254.169.254/latest/meta-data/events/recommendations/rebalance
41+
{
42+
"noticeTime": "2022-07-16T19:18:24Z"
4143
}
4244
4345
```
@@ -47,19 +49,19 @@ curl 169.254.169.254``/``latest``/``meta``-``data``/``events``/``recommendations
4749
EventBridge is an Event Bus service within AWS that allows users to set rules on events to capture and then target destinations for those events. Relevant targets for Spot interruption notifications include SQS, Lambda, and EC2-Terminate-Instance.
4850

4951
```
50-
`# Example spot interruption notification EventBridge rule`
51-
`$ aws events put``-``rule \`
52-
` ``--``name ``MyK8sSpotTermRule`` \`
53-
` ``--``event``-``pattern ``"{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Spot Instance Interruption\"]}"`
54-
55-
`# Example rebalance recommendation EventBridge rule``
56-
$ aws events put-rule \
57-
--name MyK8sRebalanceRule \
58-
--event-pattern "{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Instance Rebalance Recommendation\"]}"
59-
`` `
60-
`# Example targeting an SQS queue`
61-
`$ aws events put``-``targets ``--``rule ``MyK8sSpotTermRule`` \`
62-
` ``--``targets ``"Id"``=``"1"``,``"Arn"``=``"arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"`` `
52+
# Example spot interruption notification EventBridge rule
53+
aws events put-rule \
54+
--name MyK8sSpotTermRule \
55+
--event-pattern "{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Spot Instance Interruption\"]}"
56+
57+
# Example rebalance recommendation EventBridge rule
58+
aws events put-rule \
59+
--name MyK8sRebalanceRule \
60+
--event-pattern "{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Instance Rebalance Recommendation\"]}"
61+
62+
# Example targeting an SQS queue
63+
aws events put-targets --rule MyK8sSpotTermRule \
64+
--targets "Id=1,Arn=arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
6365
```
6466

6567

@@ -113,17 +115,17 @@ SQS exposes a VPC Endpoint which will fulfill the isolated VPC use-case.
113115
Dynamically creating the SQS infrastructure and EventBridge rules means that Karpenter’s IAM role would need permissions to SQS and EventBridge:
114116

115117
```
116-
`"sqs:GetQueueUrl",`
117-
`"sqs:ListQueues"``,`
118-
`"sqs:ReceiveMessage"``,`
119-
`"sqs:CreateQueue"``,`
120-
`"sqs:DeleteMessage"``,`
121-
`"events:ListRules",`
122-
"`events:DescribeRule`",
123-
"events:PutRule",
118+
"sqs:GetQueueUrl",
119+
"sqs:ListQueues",
120+
"sqs:ReceiveMessage",
121+
"sqs:CreateQueue",
122+
"sqs:DeleteMessage",
123+
"events:ListRules",
124+
"events:DescribeRule",
125+
"events:PutRule",
124126
"events:PutTargets",
125-
"`events:DeleteRule`",
126-
`"events:RemoveTargets"`
127+
"events:DeleteRule",
128+
"events:RemoveTargets"
127129
```
128130

129131
The policy can be setup with a predefined name based on the cluster name. For example, `karpenter-events-${CLUSTER_NAME}` which would allow for a more constrained resource policy.

0 commit comments

Comments
 (0)