Running multiple purpose nodes with karpenter
purpose
Yes ✅, you can absolutely run multiple EC2NodeClass and NodePool objects in Karpenter on the same EKS cluster for different purposes.
That’s one of the main advantages of Karpenter over the traditional Cluster Autoscaler — it gives you fine-grained control to provision nodes optimized for different workloads.
Example Use Cases
General workloads → Use t3.medium, m5.large etc. (cost-efficient, burstable)
GPU-based workloads → Use p3, g4dn, or g5 instances (for ML/AI training, inference)
Memory-optimized workloads → Use r5, r6i families (for in-memory DB, caching, analytics)
Compute-optimized workloads → Use c6i, c7g (for batch jobs, CI/CD runners, API scaling)
How it works
EC2NodeClass → Defines the infrastructure template (AMI, subnet, security group, IAM role, etc.) for nodes.
NodePool → Defines the scheduling and workload-specific constraints (labels, taints, tolerations, requirements like GPU, memory, architecture, etc.).
Each NodePool can reference one or more EC2NodeClass.
Sample Setup
apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
name: gpu-nodeclass
spec:
amiFamily: AL2
role: "KarpenterNodeRole"
subnetSelector:
karpenter.sh/discovery: my-cluster
securityGroupSelector:
karpenter.sh/discovery: my-cluster
instanceProfile: KarpenterNodeInstanceProfile
---
apiVersion: karpenter.sh/v1beta1
kind: NodePool
metadata:
name: gpu-pool
spec:
template:
spec:
requirements:
- key: "node.kubernetes.io/instance-type"
operator: In
values: ["g4dn.xlarge", "g5.xlarge"]
- key: "kubernetes.io/arch"
operator: In
values: ["amd64"]
taints:
- key: "nvidia.com/gpu"
value: "true"
effect: "NoSchedule"
disruption:
consolidationPolicy: WhenUnderutilizedYou can create similar ones for general purpose and memory optimized pools.
👉 So yes, your workloads will automatically schedule to the right pool depending on labels, taints, and requirements. This way you don’t mix GPU workloads with general workloads.
Do you want me to draft a full example with 3 different NodePools (general, GPU, memory-optimized) so you can directly apply in your cluster?
Last updated