AWS
Kubernetes
EKS
Node Labels
Cloud Computing

EKS - Node labels

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

Node labels in Amazon EKS are ordinary Kubernetes node labels used to describe nodes and steer scheduling. They are useful for targeting workloads to specific node groups, hardware types, availability zones, or operational roles, but they only help when your pods explicitly select or prefer those labels.

What Node Labels Are

A node label is a key-value pair attached to a Kubernetes node.

Examples:

  • 'workload=batch'
  • 'team=ml'
  • 'node.kubernetes.io/instance-type=m5.large'

You can inspect them with:

bash
kubectl get nodes --show-labels

EKS nodes also come with useful built-in labels from Kubernetes and AWS integration, such as region, zone, architecture, and instance type information.

Add A Label To An Existing Node

For a quick manual change:

bash
kubectl label node ip-10-0-1-25.ec2.internal workload=batch

That updates the node object immediately.

To overwrite an existing value:

bash
kubectl label node ip-10-0-1-25.ec2.internal workload=api --overwrite

This is useful for experiments and debugging, but for long-term cluster management you usually want labels applied by node group configuration or bootstrap automation rather than by ad hoc manual commands.

Use Labels In Scheduling

Node labels matter only when a workload refers to them.

The simplest form is nodeSelector:

yaml
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4  name: batch-worker
5spec:
6  replicas: 2
7  selector:
8    matchLabels:
9      app: batch-worker
10  template:
11    metadata:
12      labels:
13        app: batch-worker
14    spec:
15      nodeSelector:
16        workload: batch
17      containers:
18        - name: worker
19          image: busybox
20          command: ["sh", "-c", "sleep 3600"]

Now the pods will only schedule onto nodes labeled workload=batch.

For more flexible rules, use node affinity.

Prefer Node Affinity For Richer Logic

Node affinity lets you express preferred or required rules.

yaml
1spec:
2  affinity:
3    nodeAffinity:
4      requiredDuringSchedulingIgnoredDuringExecution:
5        nodeSelectorTerms:
6          - matchExpressions:
7              - key: workload
8                operator: In
9                values:
10                  - batch
11                  - ml

This is better than nodeSelector when:

  • multiple values are acceptable
  • the matching logic is more complex
  • you want soft preferences rather than hard requirements

That is often how production EKS clusters evolve as scheduling rules get more nuanced.

EKS Node Groups And Labels

In EKS, it is common to align labels with node groups. For example:

  • one node group for general workloads
  • one node group for GPU jobs
  • one node group for internal services

Then each group gets labels that describe its purpose.

That allows workloads to target a group by scheduling policy instead of hardcoding node names, which would be brittle and operationally expensive.

Whether you use managed node groups, self-managed nodes, or Karpenter-style provisioning, the principle stays the same: labels describe capability or role, and scheduling policies consume those labels.

Labels Versus Taints

A very common confusion is mixing up labels and taints.

  • labels help pods select nodes
  • taints repel pods unless tolerations are added

If the goal is simply "schedule these pods onto these nodes," labels plus selectors or affinity are usually enough.

If the goal is also "keep other pods away," taints and tolerations may be the better tool.

In EKS, the two are often used together for special-purpose node groups.

Keep Labels Stable And Meaningful

Good labels describe durable characteristics:

  • workload role
  • hardware type
  • environment purpose
  • region or zone identity when needed

Poor labels describe temporary operational trivia that changes frequently.

The more stable your labeling strategy is, the easier it is to build reliable scheduling rules around it.

Common Pitfalls

The biggest mistake is adding labels and expecting them to change scheduling automatically. Pods only use labels if their manifests include selectors or affinity rules.

Another mistake is labeling individual nodes manually in a managed environment and then forgetting that replacements or scaling events may create new nodes without the same ad hoc label unless the node group config also applies it.

People also overuse labels when they really need taints to protect special-purpose nodes from general workloads.

Finally, do not build scheduling around node names. In EKS, nodes come and go; labels should represent stable intent, not a particular machine identity.

Summary

  • Node labels in EKS are standard Kubernetes labels attached to nodes.
  • Use kubectl get nodes --show-labels to inspect them and kubectl label node to add or change them.
  • Labels influence scheduling only when pods use nodeSelector or node affinity.
  • Align labels with node group roles for long-term maintainability.
  • Use taints and tolerations as a separate tool when you need to repel unrelated workloads.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.