How to locate instances within an EKS cluster? How to locate instances within an EKS cluster? kubernetes kubernetes

How to locate instances within an EKS cluster?


You can't from the aws eks ... CLI specifically. Kubernetes nodes are basically EC2 instances, so hopefully, you tagged your instances appropriately when you created them, typically with an Autoscaling Group with a tool like eksctl.

Your instances typically will have a 'Name' tag that is the same as the worker node name. So you could do:

$ aws ec2 describe-instances --filters Name=tag:Name,Values=node-name

Alternatively, you can get either the NAME or the INTERNAL-IP of the node with:

$ kubectl get nodes -o=wide

Then you can find your instances based on that:

$ aws ec2 describe-instances --filter Name=private-dns-name,Values=NAME$ aws ec2 describe-instances --filter Name=private-ip-address,Values=INTERNAL-IP

Alternative, you can query the autoscaling group:

$ aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <your-asg-name> | jq .AutoScalingGroups[0].Instances[].InstanceId