Optimizing MLOps Costs with Dynamic Node Provisioning on Amazon EKS

Optimizing MLOps Costs with Dynamic Node Provisioning on Amazon EKS
Machine learning (ML) teams often face a familiar challenge: balancing compute performance with infrastructure costs. Model training can take hours or even days of high-performance computing, while inference and orchestration workloads typically require far less capacity.
Static Kubernetes clusters often lead to overprovisioned environments that waste money or underprovisioned ones that cause performance bottlenecks.
In this post, we demonstrate how to use Amazon Elastic Kubernetes Service (Amazon EKS) with Karpenter, an open-source Kubernetes cluster autoscaler, to dynamically provision compute nodes on demand. This approach enables organizations to match compute resources to workload requirements in real-time, helping to improve performance and reduce costs for MLOps workloads on AWS.
Why Static Node Groups Drive Up MLOps Costs
Most Kubernetes clusters on AWS use static node groups — predefined Amazon Elastic Compute Cloud (Amazon EC2) instances that run continuously. For ML platforms such as Kubeflow, static nodes create several operational challenges:
- Intermittent high-demand workloads: Training jobs require GPU or high-memory instances only during specific windows.
- Variable inference demand: Inference workloads scale up or down with unpredictable external requests.
- Bursty development pipelines: Data preprocessing and testing often produce short-lived, high-intensity workloads.
Organizations face a tradeoff between paying for idle capacity or risking resource shortages that slow experimentation and deployment.
Case Study: Scaling Forecasting Workloads Efficiently
A retail technology company built a forecasting platform using Kubeflow on Amazon EKS to predict daily sales for more than 10 million item-store-date combinations within a month. The system processes over 10 GB of Parquet files per run and executes up to 300 concurrent forecasting jobs. The computational requirements vary significantly throughout the day:
- Model training: Runs for approximately 4 hours with high CPU and memory utilization.
- Forecast generation: Executes in parallel for about 1 hour with moderate compute demand.
- Idle periods: Require minimal resources for orchestration and monitoring.
With static node groups, the company would need to maintain sufficient capacity to support peak loads — 300 concurrent jobs — 24 hours a day, resulting in substantial idle costs during periods of low activity.
The following architecture illustrates how these components work together to deliver a scalable and cost-efficient MLOps platform on Amazon EKS:

How Karpenter Enables Dynamic and Cost-Efficient Provisioning
Karpenter is an open-source Kubernetes cluster autoscaler that automatically provisions compute nodes based on pending pod requirements. Unlike the standard Kubernetes Cluster Autoscaler, which scales predefined node groups, Karpenter directly launches Amazon EC2 instances that match the exact resource needs of your workloads.
For machine learning workflows, Karpenter provides the following benefits:
| Benefit | Description |
| On-demand provisioning | Automatically launches nodes if necessary and terminates idle nodes, eliminating unused capacity and reducing costs. |
| Intelligent instance selection | Chooses the most cost-effective EC2 instance types that meet CPU, memory, and GPU requirements. |
| Workload-specific scaling | Allows each pipeline step — such as preprocessing, training, or inference — to request tailored resources without manual configuration. |
When running Kubeflow pipelines on Amazon EKS, each step can specify its own resource requirements. Karpenter provisions and retires nodes accordingly, ensuring that the cluster footprint scales precisely with workload demand.
For the forecasting platform, this means:
- Automatically scaling up to 300 nodes during peak forecasting periods.
- Running high-memory or GPU instances only during training.
- Scaling back to a minimal footprint during idle periods.
Organizing Dynamic Nodes with Clear Naming Conventions
Dynamic node provisioning introduces new operational challenges — particularly in identifying which nodes serve specific workloads. Consequently, without consistent organization, troubleshooting, capacity planning, and cost attribution become more complex.
A simple prefix-based naming convention can address this. By categorizing nodes by capacity (for example, S-, M-, L-, or XL-), teams can quickly:
- Gain visibility: Understand node capabilities at a glance in cluster views.
- Simplify debugging: Trace jobs and performance metrics to specific resource tiers.
- Improve cost tracking: Align node groups with workload categories in AWS Cost Explorer.
In the forecasting platform example, small (S-) nodes handle orchestration and lightweight processing, while larger (L- and XL-) nodes manage data-intensive training and forecasting workloads.
To implement this naming convention in the cluster, you can define a dedicated Karpenter NodePool and NodeClass for each node tier, as shown below:
apiVersion: karpenter.sh/v1beta1
kind: NodePool
metadata:
name: s-nodes
spec:
template:
metadata:
labels:
node.kubernetes.io/type: "s"
spec:
nodeClassRef:
name: s-nodeclass
requirements:
- key: "karpenter.k8s.aws/instance-family"
operator: In
values: ["m6", "m6a"]
- key: "karpenter.sh/capacity-type"
operator: In
values: ["spot", "on-demand"]
limits:
cpu: 100
---
apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
name: s-nodeclass
spec:
amiFamily: AL2023
role: "KarpenterNodeRole"
subnetSelector:
karpenter.sh/discovery: "eks-demo"
securityGroupSelector:
karpenter.sh/discovery: "eks-demo"
To automatically route workloads to the correct node tier based on their prefix, you can use a Kyverno policy that adds the appropriate node affinity to matching pods:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: apply-node-affinity-based-on-pod-prefix
spec:
mutateExistingOnPolicyUpdate: true
rules:
- name: add-affinity-s
match:
resources:
kinds:
- Pod
name: "s-*"
mutate:
patchStrategicMerge:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/type
operator: In
values:
- "s"
- name: add-affinity-m
match:
resources:
kinds:
- Pod
name: "m-*"
mutate:
patchStrategicMerge:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/type
operator: In
values:
- "m"
- name: add-affinity-l
match:
resources:
kinds:
- Pod
name: "l-*"
mutate:
patchStrategicMerge:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/type
operator: In
values:
- "l"
Measuring the Cost and Performance Benefits
Organizations adopting Karpenter with Amazon EKS often observe the following improvements:
- Lower idle costs: Nodes exist only during active workloads.
- Better instance matching: Compute is right-sized to each job, minimizing waste.
- Higher utilization: Resource consumption closely tracks demand.
- Elastic capacity: Large experiments scale up temporarily, then automatically scale down.
In the retail forecasting use case, the company achieved an estimated 30–50% reduction in compute costs by combining Karpenter, Amazon EC2 Spot Instances, and Savings Plans. Dynamic autoscaling eliminated idle capacity costs while maintaining service-level objectives during peak workloads.
Beyond cost optimization, the platform also reduced model deployment cycles — from weeks to hours — enabling data scientists to iterate faster and improve model quality.
Building a Scalable, Cost-Optimized MLOps Platform
Dynamic node provisioning works best as part of an integrated, managed MLOps architecture. The forecasting platform combined several AWS services to achieve scalability, reliability, and cost efficiency:
- Amazon EKS provides the managed Kubernetes control plane, removing cluster management overhead.
- Amazon Aurora serves as the metadata store for Kubeflow, decoupling pipeline state from the cluster and improving fault tolerance.
- Amazon Simple Storage Service (Amazon S3) stores raw data, features, and inference results. Pipelines read and write Parquet files directly from S3, while Karpenter scales compute capacity as needed.
- AWS Identity and Access Management (IAM) and AWS Secrets Manager manage authentication and secret rotation, integrated with on-premises identity systems through AWS Direct Connect.
- Amazon CloudWatch and AWS Budgets offer observability and cost management, providing alerts to prevent unexpected expenses.
This architecture allowed the company to deploy workloads in private subnets, isolate sensitive components, and maintain production-grade reliability — all while minimizing infrastructure overhead.
Best Practices for Configuring Dynamic Node Provisioning
To maximize efficiency and control costs when implementing dynamic node provisioning:
- Set node termination policies carefully: Configure Karpenter to remove idle nodes promptly but safely.
- Standardize naming conventions: Use consistent prefixes (S-, M-, L-, XL-) for clarity and cost tracking.
- Define resource boundaries: Set maximum vCPU and memory limits per node type to avoid runaway costs.
- Specify pod resource requests: Define CPU, memory, and GPU needs in Kubernetes manifests to ensure optimal instance selection.
- Monitor continuously: Use Amazon CloudWatch, Prometheus, or Grafana to track utilization and identify opportunities for optimization.
Use Spot Instances for fault-tolerant jobs: Combine Amazon EC2 Spot Instances with Karpenter’s instance diversity for additional savings.
Conclusion: Dynamic Provisioning as a Catalyst for Scalable MLOps
By combining Amazon EKS with Karpenter, organizations can dynamically match compute capacity to workload requirements — reducing costs while maintaining the agility that modern ML teams need.
The retail forecasting platform described in this post demonstrates these benefits in production:
- Processing more than 10 million daily predictions
- Running hundreds of concurrent jobs
- Achieving 30–50% compute cost savings while reducing deployment cycles from weeks to hours.
For teams running Kubeflow or similar machine learning platforms on AWS, dynamic node provisioning provides a practical and cost-effective path to scalable and efficient MLOps.