Instance Types & Scaling

Choose the right EC2 instance types and set min/max sizes so node groups scale with demand.

A node group is backed by an Auto Scaling group with a minimum, desired, and maximum node count. Picking instance types and these bounds well is key to cost and performance.

Choosing instance types

  • General purpose (t3, m5/m6i) — balanced CPU and memory for typical services.
  • Compute optimized (c6i) — CPU-heavy workloads like batch processing.
  • Memory optimized (r6i) — caches and in-memory databases.
  • GPU (g5, p4) — machine learning and rendering.

Mix types for resilience

You can list several instance types in one group so the ASG can fall back if one type is unavailable — especially useful with Spot Instances.

Example

Example · yaml
managedNodeGroups:
  - name: ng-spot
    instanceTypes: ["t3.large", "t3a.large", "m5.large"]
    spot: true
    minSize: 2
    desiredCapacity: 3
    maxSize: 10
    labels:
      lifecycle: spot

When to use it

  • An ML team selects p3.2xlarge GPU instances for training node groups while keeping general workloads on m5.large to balance cost and performance.
  • A platform team sets min=2 max=20 on a node group so the Cluster Autoscaler can handle 10x traffic spikes without over-provisioning baseline capacity.
  • A cost optimization team diversifies across m5.large, m5a.large, and m4.large in a single node group to maximize Spot availability.

More examples

Mixed instance node group

Configures a managed node group with multiple instance types and Spot to maximize availability and reduce cost.

Example · yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: prod
  region: us-east-1
managedNodeGroups:
- name: mixed-workers
  instanceTypes: ["m5.large", "m5a.large", "m4.large"]
  minSize: 2
  maxSize: 20
  spot: true

Taint GPU node group

Creates a GPU node group with a taint so only pods that explicitly tolerate it are scheduled there, preventing CPU workloads from landing on expensive GPU nodes.

Example · bash
eksctl create nodegroup \
  --cluster prod \
  --name gpu-workers \
  --node-type g4dn.xlarge \
  --nodes-min 0 \
  --nodes-max 4 \
  --node-taints nvidia.com/gpu=true:NoSchedule

View node capacity and allocatable

Shows the total and allocatable CPU and memory for each node, helping right-size instance types and set workload resource requests.

Example · bash
kubectl get nodes -o custom-columns=\
'NAME:.metadata.name,CPU:.status.capacity.cpu,MEM:.status.capacity.memory,ALLOC_CPU:.status.allocatable.cpu,ALLOC_MEM:.status.allocatable.memory'

Discussion

  • Be the first to comment on this lesson.