terraform-aws-modules / terraform-aws-eks

Terraform module to create Amazon Elastic Kubernetes (EKS) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/eks/aws
Apache License 2.0
4.44k stars 4.06k forks source link

Cannot pass a label to eks_managed_node_group #3081

Closed gagbo closed 2 months ago

gagbo commented 3 months ago

Description

It might be a duplicate of #2976

My eks_managed_node_group is :

    infra = {
      name           = "infrastructure"
      instance_types = ["t3.medium"]
      min_size       = 1
      desired_size   = 1
      max_size       = 1
      ami_type = "AL2023_x86_64_STANDARD"
      labels = {
        "fp.io/node-type" = "infrastructure"
      }
      tags = {
        "FP.Environment" = "demo"
      }
    }

But when I check the associated node in kubernetes using describe I don’t see my label

Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/instance-type=t3.medium
                    beta.kubernetes.io/os=linux
                    eks.amazonaws.com/capacityType=ON_DEMAND
                    eks.amazonaws.com/nodegroup=infrastructure-2024[...]0002
                    eks.amazonaws.com/nodegroup-image=ami-0d021dbc3a8319a1a
                    eks.amazonaws.com/sourceLaunchTemplateId=lt-0f0b8aabc774e4d54
                    eks.amazonaws.com/sourceLaunchTemplateVersion=1
                    failure-domain.beta.kubernetes.io/region=eu-central-1
                    failure-domain.beta.kubernetes.io/zone=eu-central-1a
                    k8s.io/cloud-provider-aws=66ec3[...]7c5879
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=ip-10-0-1-6.eu-central-1.compute.internal
                    kubernetes.io/os=linux
                    node.kubernetes.io/instance-type=t3.medium
                    topology.ebs.csi.aws.com/zone=eu-central-1a
                    topology.k8s.aws/zone-id=euc1-az2
                    topology.kubernetes.io/region=eu-central-1
                    topology.kubernetes.io/zone=eu-central-1a

If your request is for a new feature, please use the Feature request template.

⚠️ Note

I will edit to try to fit this node group in one of the examples, but given #2976 I suppose there’s something obvious I missed in the documentation?

Versions

Reproduction Code

Just replacing the label from GithubOrg to "fp.io/node-type" in the eks example for AL2023 should be enough

Steps to reproduce the behavior:

Init and apply an aws_eks_cluster with an eks_managed_node_groups value containing:

    infra = {
      name           = "infrastructure"
      instance_types = ["t3.medium"]
      min_size       = 1
      desired_size   = 1
      max_size       = 1
      ami_type = "AL2023_x86_64_STANDARD"
      labels = {
        "fp.io/node-type" = "infrastructure"
      }
      tags = {
        "FP.Environment" = "demo"
      }
    }

Expected behavior

Have the label fp.io/node-type on all nodes in the node group

Actual behavior

The label does not appear

Terminal Output Screenshot(s)

See above the list of labels in kubectl describe node after the apply

Additional context

There’s a mention in the documentation about being compatible with EKS API, but I couldn’t find this documentation anywhere. And I suppose I should not need to mess with the bootstrap scripts/user data to add a label, so I suppose I missed something

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

DmitryPaulouski commented 2 months ago

Experiencing the same issue

bryantbiggs commented 2 months ago

this is supported - however, without a reproduction it will be challenging to help troubleshoot. please take a look at the examples and tests that we provide for guidance

github-actions[bot] commented 1 month ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.