containers-roadmap icon indicating copy to clipboard operation
containers-roadmap copied to clipboard

[EKS] [Node Group]: Give EC2 instances a Name tag

Open tobdub-snce opened this issue 4 years ago • 30 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction 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 Add Name tag to EKS nodegroup instances, based on the node group name.

Which service(s) is this request for? EKS node groups.

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? Give EKS EC2 node group instances a Name to make them easier to identify, similar to ECS instances.

Are you currently working around this issue? Manually adding Name tag.

tobdub-snce avatar Mar 09 '20 08:03 tobdub-snce

In general we need our tags to propagate to all resources created by the EKS service as part of a managed node group.

webster-chainalysis avatar Apr 21 '20 14:04 webster-chainalysis

I see that I can specify Tags for a node group, but it is static. I'd like to apply something like:

Screen Shot 2020-04-26 at 8 24 36 PM
Name: eks-stage-worker-${number}

Where ${number} represents the worker number.

nodesocket avatar Apr 27 '20 01:04 nodesocket

It's extremely painful to see a huge list of unnamed ec2 instances when you're managing multiple node groups or multiple clusters and can't quickly discern which cluster/node group an instance belongs to.

woz5999 avatar May 07 '20 18:05 woz5999

Yes as @webster-chainalysis mentioned currently the managed node group tags are not propagated to aws resources. Not sure should we open a new issue or edit this issue to correctly propose propagating managed node groups tags to aws resources ?

bhegazy avatar May 11 '20 10:05 bhegazy

There is an issue for propagating all tags: https://github.com/aws/containers-roadmap/issues/374

tobdub-snce avatar May 11 '20 15:05 tobdub-snce

Thanks @tobdub I did not see that 👍

bhegazy avatar May 11 '20 15:05 bhegazy

This is different from #374, as I would not expect the NodeGroup's 'Name' tag to propagate down to each EC2 instance, but a unique Name to be generated for each EC2 instance, probably based on the NodeGroup's 'Name' tag. Similar thinking to what https://github.com/terraform-providers/terraform-provider-aws/issues/12451 was looking for, I think.

TBBle avatar May 27 '20 16:05 TBBle

Although it's not a perfect fix for the issue described here, the new launch template enhancement (#585) looks like it allows setting static tags for instances and volumes in an EKS managed node group. Caveats include that the tags are static per launch template (i.e., you would likely have a LT per node group or cluster), and it's possible that it's a heavy-handed approach for folks that don't need the rest of the LT knobs.

rwolfson avatar Aug 21 '20 16:08 rwolfson

hello, has there been a fix on this case? it's really a pain to keep naming blank EC2 instances of the EKS node group even if they are being referenced on the tags section of the EC2.

sanpedroadrian28 avatar Aug 25 '20 10:08 sanpedroadrian28

There is a workaround: https://stackoverflow.com/questions/63328382/how-can-i-name-eks-worker-nodes-provisioned-with-terraform

But if you need to specify multiple node groups, not sure how to do it.

juan-caylent avatar Sep 23 '20 05:09 juan-caylent

As everyone else has clearly pointed out, using launch templates just to propagate the Name tag is pretty horrendous. Is there any news on resolving this issue?

acesir avatar Oct 16 '20 22:10 acesir

I'm not exactly sure which issue to put this on so I'll probably but it in a decent number of issues but not having propagating Tags to all EKS cluster resources effectively makes this entire service useless. If you can't tag your resources you can't separate out costs between different programs and therefore will never be allowed by a program manager and rightfully so. This needs to be fixed ASAP.

MichaelX99 avatar Dec 22 '20 23:12 MichaelX99

It's extremely painful to see a huge list of unnamed ec2 instances when you're managing multiple node groups or multiple clusters and can't quickly discern which cluster/node group an instance belongs to.

Is there any solution to this issue yet?

rasheedromana97 avatar Feb 03 '21 17:02 rasheedromana97

One year past, it seems that no good solution yet ?

rustlingwind avatar Mar 21 '21 02:03 rustlingwind

Any update?

SantiEich avatar Mar 29 '21 14:03 SantiEich

Any update? This feature is very important for our DevOps team.

amitkarpe avatar Mar 30 '21 04:03 amitkarpe

There is a workaround by using AWS CLI aws autoscaling create-or-update-tags

casper-gh avatar Jun 23 '21 07:06 casper-gh

How does a tag on the ASG put a name on the EC2 instances? Is there a special tag that will propagate and have some kind of template operation done?

TBBle avatar Jun 23 '21 07:06 TBBle

@TBBle There's an option called "Propagate at Launch" when you add new tags to ASG.

casper-gh avatar Jun 23 '21 07:06 casper-gh

Won't that propagate the same name to each instance though? Simply adding a tag to the nodes in an instance group is already supported, see https://github.com/aws/containers-roadmap/issues/608#issuecomment-675101463 and the docs, so you don't need to add a tag to the EKS-managed ASG and set it to propagate.

I had understood this issue to be requesting that each instance get a unique Name tag, e.g., https://github.com/aws/containers-roadmap/issues/781#issuecomment-619660700

TBBle avatar Jun 23 '21 09:06 TBBle

@TBBle The docs mention the launch templates, which does seem like an option (I can't seem to get the tagging set up from CloudFormation though - I haven't specifically tried to troubleshoot that though). It is possible to create Managed node groups without manually created launch templates as well though (and editing the automatically created one seems far from ideal) and those don't seem to have a way to control the tags on the instances (without messing with the ASG or laucnh template that EKS creates)

mohag avatar Jun 23 '21 13:06 mohag

I know eksctl uses CloudFormation and Launch Templates to apply tags to managed node group nodes, so it might be worth a trawl through their implementation if you're looking for inspiration.

At this point, an AWS person and the AWS docs have said that "tagging EC2 instances" is supported through the launch template, so if you're not satisfied with that, best to raise it as a feature request ticket here, probably giving the rationale as to why it's not sufficient or useable-enough. That's what #608 started as, but it's now focussed on tagging ASGs for their own sake, not for propagating to instances, so it'd just be confusing to post it there.

In the meantime, this ticket is still sitting here looking for a way to generate names for EC2 instances from their node-group name, a use-case not covered by any of the existing tickets or systems.

TBBle avatar Jun 24 '21 07:06 TBBle

I know eksctl uses CloudFormation and Launch Templates to apply tags to managed node group nodes, so it might be worth a trawl through their implementation if you're looking for inspiration.

At this point, an AWS person and the AWS docs have said that "tagging EC2 instances" is supported through the launch template, so if you're not satisfied with that, best to raise it as a feature request ticket here, probably giving the rationale as to why it's not sufficient or useable-enough. That's what #608 started as, but it's now focussed on tagging ASGs for their own sake, not for propagating to instances, so it'd just be confusing to post it there.

In the meantime, this ticket is still sitting here looking for a way to generate names for EC2 instances from their node-group name, a use-case not covered by any of the existing tickets or systems.

Really eksctl does that? i dont see in the help eksctl create nodegroup , anything related to tags

svenkat89 avatar Sep 02 '21 07:09 svenkat89

See nodeGroups.tags in the schema:

Applied to the Autoscaling Group and to the EC2 instances (unmanaged), Applied to the EKS Nodegroup resource and to the EC2 instances (managed)

It's also demonstrated in the "Launch Template support for Managed Nodegroups" and "Auto Scaling" documentation.

The tags configured there will be combined with the "all resources" tags, documented in "Getting Started" and metadata.tags in the config file.

For managed node groups the implementation is in func (m *ManagedNodeGroupResourceSet) makeLaunchTemplateData() and for unmanaged node groups, the implementation is in func newLaunchTemplateData(n *NodeGroupResourceSet).

Both are populating AWS::EC2::LaunchTemplate's TagSpecifications property.

TBBle avatar Sep 02 '21 08:09 TBBle

I created node-group using CloudFormation and added the tag specification in the launch template to populate the same tags on all node-group resources ASG create.

NodeLaunchTemplate: Type: "AWS::EC2::LaunchTemplate" Properties: LaunchTemplateData: ImageId: !Ref NodeImageId KeyName: !Ref KeyName SecurityGroupIds: - !Ref NodeSecurityGroup TagSpecifications: - ResourceType: instance Tags: - Key: Name Value: kumo-eks-apinode - ResourceType: volume Tags: - Key: Name Value: kumo-eks-apinode

chandrapratapsingh08 avatar Oct 06 '21 11:10 chandrapratapsingh08

Amazon, plesase. Add an option for this. Is very ugly to see unnamed instances on EC2 pannel everytime my cluster autoscales

lfvillavicencio avatar Jan 28 '22 00:01 lfvillavicencio

Any news?

OloBo-MSK avatar Mar 27 '22 20:03 OloBo-MSK

Any news?

Yes! Just add a Tag in your autoscaling group with the Key Name and its value will be the name of the EC2 instances created when scaling!!

image

lfvillavicencio avatar Mar 28 '22 00:03 lfvillavicencio

Any news?

Yes! Just add a Tag in your autoscaling group with the Key Name and its value will be the name of the EC2 instances created when scaling!!

image

That's still a manual step post creation of the EKS node group(s), it would be nice if the tags from the EKS node group resource would propagate its tags onto the tags of the ASG which would then propagate to the EC2 nodes themselves.

celestialorb avatar Aug 25 '22 20:08 celestialorb

If you just want to set constant tags per-nodegroup on the EC2 instances, you can set them now in the Launch Template, e.g. if using eksctl, see the links in https://github.com/aws/containers-roadmap/issues/781#issuecomment-911347798.

it would be nice if the tags from the EKS node group resource would propagate its tags onto the tags of the ASG

Perhaps upvote #1541 which is somewhat for this, based on the first comment. The original request didn't talk about propagating tags from NodeGroup to ASG. There's #374 which is similar, but for propagating tags from the Cluster object down to all its contained/owned objects.

TBBle avatar Aug 26 '22 06:08 TBBle