Open tobdub-snce opened 4 years ago
In general we need our tags to propagate to all resources created by the EKS service as part of a managed node group.
I see that I can specify Tags for a node group, but it is static. I'd like to apply something like:
Name: eks-stage-worker-${number}
Where ${number}
represents the worker number.
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.
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 ?
There is an issue for propagating all tags: https://github.com/aws/containers-roadmap/issues/374
Thanks @tobdub I did not see that 👍
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.
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.
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.
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.
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?
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.
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?
One year past, it seems that no good solution yet ?
Any update?
Any update? This feature is very important for our DevOps team.
There is a workaround by using AWS CLI aws autoscaling create-or-update-tags
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 There's an option called "Propagate at Launch" when you add new tags to ASG.
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 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)
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.
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
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.
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:
Amazon, plesase. Add an option for this. Is very ugly to see unnamed instances on EC2 pannel everytime my cluster autoscales
Any news?
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!!
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!!
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.
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.
We provision our EKS cluster using terraform-aws-eks-blueprints - this workaround is working for us for applying a Name
tag. It uses a Terraform data source to grab the EKS node group Name
tag and apply it as a propagating tag on the related autoscaling group. The same basic approach should work with any terraform approach for provisioning node groups.
module "eks_blueprints" {
source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.23.0"
# ...
managed_node_groups = {
ng_a = {
node_group_name = "ng-a"
# ...
}
}
}
data "aws_eks_node_group" "ng_a" {
cluster_name = module.eks_blueprints.eks_cluster_id
node_group_name = split(":", module.eks_blueprints.managed_node_groups[0].ng_a.managed_nodegroup_id[0])[1]
}
resource "aws_autoscaling_group_tag" "ng_a_Name" {
autoscaling_group_name = data.aws_eks_node_group.ng_a.resources[0].autoscaling_groups[0].name
tag {
key = "Name"
value = data.aws_eks_node_group.ng_a.tags.Name
propagate_at_launch = true
}
}
What a shame that such a basic thing is missing and no one seems to care
Community Note
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.