[EKS] [request]: Label nodes with instance-id
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
I want nodes to have a label `eks.amazonaws.com/instance-id=` added
**Which service(s) is this request for?**
EKS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
When I have scheduled event alerts in AWS, I get the instance-id of the affected node. I then want
to run `kubectl get node -leks.amazonws.com/instance-id=$instanceId` to quickly find out what kubernetes node is affected and e.g. drain it.
**Are you currently working around this issue?**
I have the following script:
```bash
#!/usr/bin/env bash
set -euo pipefail
instanceId=$1
aws ec2 describe-instances --instance-ids "$instanceId" --query "Reservations[*].Instances[*][PrivateDnsName]" --output text
```
Which I call like this:
```
kubectl get node $(./hack/get-node-name.sh i-09687bfe3931549c6)
```
**Additional context**
Anything else we should know?
**Attachments**
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)
Contributor guide
Research direction
The issue names EKS, kubectl, and the workaround script hack/get-node-name.sh; begin by reviewing how EKS-managed nodes expose instance metadata and how the script resolves instance IDs. Done means affected nodes carry the requested instance-id label and the kubectl selector identifies the node without the AWS lookup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, bash, kubernetes
- Domain
- cloud, devops, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100