How to add custom tag to the EKS cluster instance

Viewed 45

I have an eks cluser with a node group and two instances. Is there any way to add custom tag to those two eks cluser instances?

For example, Add custom tagging like Name env application to the ec2 instances present in node group.

Note: Not looking for k8 labels. I am looking for a way to add aws tags to the instances comes under my eks node group.

3 Answers

In general, you would label/ tag the node groups on EkS clusters, so that all nodes under the particular node group are labelled the same, but if you want to label nodes individually, use the below.

*The below should pull up the nodes/instances with existing labels

kubectl get nodes --show-labels


NAME      STATUS    ROLES    AGE     VERSION        LABELS
worker0   Ready     <none>   1d      v1.13.0  ...,kubernetes.io/hostname=worker0

*Label/tag the node as below with new label
kubectl label nodes <your-node-name> disktype=ssd

*Veriy if the nodes have been labelled
kubectl get nodes --show-labels

I am looking for a way to add aws tags to the instances comes under my eks node group.

You can try AWS Console > ASG > [select the node group] > [select the Launch template] > [select the Launch template ID] > Actions > Modify template (Create new version) > Resource Tags

Adding and deleting tags on a resource:

You can add or delete the tags that are associated with your clusters directly from the resource's page.

To add or delete a tag on an individual resource

  1. Open the Amazon EKS console at https://console.aws.amazon.com/eks/home#/clusters.

  2. On the navigation bar, select the AWS Region to use.

  3. In the left navigation pane, choose Clusters.

  4. Choose a specific cluster.

  5. Choose the Tags tab, and then choose Manage tags.

  6. On the Manage tags page, add or delete your tags as necessary.

    To add a tag, choose Add tag. Then specify the key and value for each tag.

    To delete a tag, choose Remove tag.

  7. Repeat this process for each tag that you want to add or delete.

  8. Choose Update to finish.

enter image description here

Here add key value as env and value as test or as per requirements..

Related