TalksAWS re:Invent 2025 - Supercharge your Karpenter: Tactics for smarter K8s optimization (COP208)

AWS re:Invent 2025 - Supercharge your Karpenter: Tactics for smarter K8s optimization (COP208)

Supercharging Kubernetes Optimization with Karpenter

Balancing Cost and Performance

  • Achieving the right balance between cost and performance is a key challenge for DevOps and platform engineers running complex production workloads on Kubernetes.
  • Simply throwing more resources at the problem can provide stability and performance, but at a high cost.
  • Scaling down to the bare minimum can reduce costs, but may lead to resource constraints and availability issues.
  • The goal is to find the sweet spot - providing just the right infrastructure to meet the demands of the workloads without over or under-provisioning.

Karpenter's Consolidation Policies

  • Karpenter's "consider consolidation" policies automatically monitor nodes and terminate underutilized ones to save costs.
  • This feature requires careful configuration and guardrails:
    • Using Pod Disruption Budgets (PDBs) to control how many replicas can be interrupted at once.
    • Setting consolidation delays to prevent Karpenter from reacting to short-term usage dips.
  • Proper configuration allows consolidation during off-peak periods without impacting production traffic.

Choosing the Right Instance Mix

  • Providing Karpenter with a diverse set of instance types and sizes gives it more flexibility to balance cost and availability.
  • Avoid including instances that are too small (high network overhead) or too large (poor consolidation efficiency).
  • Monitor the cluster behavior to determine the right instance size thresholds for your specific use case.
  • Consider the overhead of DaemonSet containers running on each node, as this can impact costs, especially for licensed software.

Leveraging Spot Instances

  • Karpenter makes it easy to manage spot instances, automatically identifying the best spot prices and availability.
  • Spot instances can provide significant cost savings for workloads that can tolerate interruptions, such as:
    • Web servers behind a load balancer
    • Stateless microservices
    • Batch jobs
    • Development and staging environments
  • Configure Karpenter to use a mix of spot and on-demand instances, with spot as the primary and on-demand as a fallback.
  • Consider using Graviton-based instances, which can offer similar or better performance at a lower cost.

Optimizing for Cost Efficiency

  • Limiting node pools to a single Availability Zone can reduce cross-AZ networking costs for non-production environments, but should not be used in production.
  • Connecting Kubernetes metrics to actual costs is challenging, especially in large, multi-cluster environments.
  • Karpenter makes instant decisions, but the underlying infrastructure may not be able to keep up, leading to operational complexity.
  • Continuous automation and optimization platforms, like Zesti, can help by:
    • Providing deep visibility into usage and utilization
    • Using predictive models to make more efficient scaling decisions
    • Automatically resizing workloads and distributing them across spot and on-demand instances
    • Maintaining a fleet of pre-cached, hibernated nodes for instant recovery from spot interruptions

Key Takeaways

  • Karpenter's consolidation policies, instance selection, and spot instance management can significantly improve cost efficiency in Kubernetes.
  • Careful configuration and guardrails are necessary to balance cost savings and production stability.
  • Combining Karpenter with a comprehensive optimization platform can further enhance cost savings and operational efficiency.
  • Leveraging Graviton-based instances and limiting cross-AZ traffic can provide additional cost benefits, but require careful consideration.

Your Digital Journey deserves a great story.

Build one with us.

Cookies Icon

These cookies are used to collect information about how you interact with this website and allow us to remember you. We use this information to improve and customize your browsing experience, as well as for analytics.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference.