Amazon EKS Cost Optimization
Running Kubernetes on AWS is simple with Amazon Elastic Kubernetes Service (Amazon EKS). Amazon EKS is a managed service that makes it easy for you to start, run and scale Kubernetes applications in the cloud or on-premises — without installing and operating your own Kubernetes control plane or worker nodes.
Amazon EKS runs the open-source Kubernetes software and provides highly available and secure clusters while automating key tasks such as patching, node provisioning, and updates. A Kubernetes application running on Amazon EKS is fully compatible with any standard Kubernetes application — so you can migrate any standard Kubernetes application to Amazon EKS without modifying its code.
EKS simplifies Kubernetes operations tasks, but costs can quickly spiral out of control as Kubernetes environments become more complex. In this article, we will cover the benefits of using EKS, the cost drivers for containerized applications running on EKS, and how cloud cost management solutions like Anodot can help you control EKS costs.
Amazon EKS benefits
Amazon EKS enables you to take full advantage of the performance, scale, reliability, and availability of AWS resources, as well as integrations with AWS networking and security services.
Cloud, on-premises, or hybrid. You can run EKS in the cloud using AWS EC2 or AWS Fargate, which provides serverless compute for containers. With Fargate, you don’t need to provision and manage servers, you specify and pay for resources per application, and improve security through application isolation by design. In the cloud, EKS automatically manages the availability and scalability of the Kubernetes control plane nodes responsible for scheduling containers, managing application availability, storing cluster data, and other key tasks. You can also run EKS on-premises with integrated tooling and simple deployment to AWS Outposts, virtual machines, or bare metal servers.
High availability and fault tolerance. EKS provisions and scales the Kubernetes control plane, including the application programming interface servers and backend persistence layer, across multiple AWS Availability Zones. Additionally, EKS automatically detects and replaces unhealthy control plane nodes, and patches the control plane.
High scalability and security. Amazon EKS supports IPv6 for scalability beyond private IPv4 address spaces, and is integrated with many AWS services including: Elastic Load Balancing for load distribution, AWS Identity and Access Management (IAM) for authentication, Amazon Virtual Private Cloud (VPC) for isolation, AWS App Mesh for service mesh, AWS Cloud Map for service discovery, AWS CloudTrail for logging, and Amazon CloudWatch for analysis, debugging, and auditing.
Amazon EKS cost drivers
The main components of Kubernetes applications are:
- Clusters — a group of control plane nodes
- Nodes — the actual EC2 instances that pods run on
- Pods — the smallest deployable units you can create and manage in Kubernetes
Amazon EKS pricing has two components:
- Cost of EKS cluster — $0.10 per hour for each cluster
- Cost of AWS resources for underlying Kubernetes worker nodes — compute, storage, load balancing, data transfer, monitoring, auto-scaling, etc.
Pods are not a billable component, but pod resource requests — which are specified and limited for vCPU and memory when pods are configured — are the primary driver of the number of EC2 instances needed to support clusters.
Misconfigured or partially configured pod resource request specifications can significantly impact the cost of running your cluster.
Resources allocated to a pod become unavailable to other pods deployed on the same node. Once a node’s resources are fully allocated, another node is spun up to host additional pods via a cluster auto scaling tool.
The underlying nodes will drive the largest part of your Kubernetes costs.
Node costs are driven by the following parameters:
Cloud deployment type
You can run EKS in the cloud using Amazon EC2 or AWS Fargate, which provides serverless compute for containers. If you’re using AWS Fargate, you can expect to pay 15%-40% more for the same vCPU and memory when compared to EC2 On-Demand prices.
With Amazon EC2, you pay for the compute capacity of the node you have purchased, whether your pods and their containers fully utilize it or not. With Amazon Fargate, you pay for the amount of vCPU, memory, and storage resources used by your containerized applications running on Amazon EKS.
Worker node configuration
Processor vendor and architecture
AWS offers three types of processors: Intel (x86) processors, AMD (x86) processors that are priced 10% lower than comparable Intel-based processors, and AWS Graviton (ARM) processors that are priced 20% lower than comparable Intel-based processors.
Amazon EKS supports Linux x86, ARM, and Windows Server operating systems compatible with Kubernetes. Instances using Windows Server can cost as much as 120% more than those using Linux.
Amazon EC2 provides a wide selection of instance types optimized to fit different use cases — general purpose, compute-optimized, memory-optimized, accelerated computing, storage-optimized, and HPC-optimized — and give you the flexibility to choose the appropriate mix of resources for your applications.
Instance size — vCPU and memory
Instances consist of varying combinations of CPU, memory, storage, and networking capacity. Instance size (e.g., medium, large, xlarge, etc.) is the main driver of your underlying Amazon EC2 hourly cost, with costs doubling with every increase in instance size. Current generation instances provide better price performance than previous generation instances. Amazon EC2 instances are available with as little as 1 vCPU and 0.5 GB of memory, and up to 448 vCPUs and 12 TB of memory. Amazon Fargate can be configured with as little as 0.25 vCPU and 0.5 GB of memory, and up to 16 vCPUs and 120 GB of memory.
While Amazon EKS pricing is straightforward — $0.10 per cluster per hour — there are multiple ways to purchase the cloud resources for the underlying nodes: On-Demand, Savings Plans, Reserved Instances, Committed Use Discounts, and Spot Instances. Using On-Demand is the most expensive option.
Adopting flexible pricing models that offer discounts based on commitment or availability is a great way to reduce Amazon EKS spend. The hourly cost significantly decreases with payment options like Spot Instances or machines covered by a commitment agreement, which offer up to 90% and 72% off On-Demand prices, respectively.
When using Amazon Fargate, the only flexible pricing model available is Savings Plans, which offers savings of up to 50% on your AWS Fargate usage in exchange for a commitment to use a specific amount of compute (measured in dollars per hour) for a one- or three-year term.
Optimize Amazon EKS costs with Anodot
With Amazon EKS becoming more popular, organizations are seeking better ways to understand and control their costs.
Maximizing utilization without negatively impacting workload performance can be quite challenging. In fact, most organizations struggle with Kubernetes cost optimization, and find that they are heavily overprovisioned with generally low utilization across their Kubernetes nodes.
Anodot’s cloud cost management platform monitors cloud metrics together with revenue and business metrics, so users can understand the true unit economics of customers, applications, teams, and more. Anodot enables FinOps stakeholders from finance and DevOps to optimize their cloud investments.
Anodot correlates Kubernetes metrics collected with data from the AWS Cost and Usage Report, AWS pricing, and other sources. This correlation provides insight into pod resource utilization, node utilization, and waste. It also provides visibility into the cost of each application that is run.
Anodot also offers specific easy-to-action EC2 cost-saving recommendations for the underlying worker nodes — including rightsizing, commitment purchase recommendations, instance family and generation optimization, OS optimization, and unused resource management.
Anodot’s cost allocation feature enables users to produce rule-powered maps that associate costs with business cost centers using tags, namespaces, deployments, labels, and other identifiers. Users can visualize the maps and create dashboards to better understand cost per department, application, or unit metric.