Kubernetes is a highly popular open-source container orchestration platform. Amazon Web Services (AWS) is a top cloud computing vendor that provides a wide range of services—including running Kubernetes on the AWS cloud.
You can self-manage Kubernetes on Amazon Elastic Compute Cloud (Amazon EC2), by installing Kubernetes directly on EC2 instances. Alternatively, you can opt to use Amazon Elastic Kubernetes Service (Amazon EKS) to manage Kubernetes on AWS resources.
Another notable managed service is Amazon Elastic Container Service (AWS ECS), which provides container orchestration using Amazon-built technology—not using Kubernetes. ECS simplifies management while letting you control and fine-tune orchestration processes.
In this article, you will learn:
- Kubernetes on AWS Deployment Options
- The AWS Kubernetes Alternative: Amazon Elastic Container Service (AWS ECS)
- Optimizing Kubernetes Storage with Cloud Volumes ONTAP
Kubernetes on AWS Deployment Options
Self-Managed Option: Kubernetes on Amazon EC2
It is possible to run Kubernetes directly on Amazon infrastructure, without using one of Amazon’s managed container services. This involves:
- Creating the required Amazon EC2 instances—Amazon provides compute instances that host your Kubernetes nodes.
- Installing Kubernetes—you will need to choose a Kubernetes distribution, set up and manage Kubernetes on your own.
Amazon Elastic Kubernetes Service (AWS EKS)
EKS manages Kubernetes for you, performing the following tasks:
- Managing Kubernetes master nodes and control plane
- Security configurations, patches and upgrades.
- Scaling persistent backend layers and API servers
- Replicating master schedulers across 3 availability zones to increase availability
- Scanning for and replacing unhealthy nodes automatically
Because EKS is based on open-source platforms, it lets you move pods to a non-AWS environment without code changes.
To use Amazon EKS, you provision worker nodes and connect them to Amazon EKS endpoints. You must select a Virtual Private Cloud (VPC) and specify security groups and IAM roles to help secure the VPC traffic. While it is possible to run all your clusters on a single VPC, it is recommended that you use a different VPC for each cluster to improve network isolation and enhance your overall security profile.
EKS integrates with Amazon services including Amazon Virtual Private Cloud (VPC), Elastic Load Balancing (ELB), Identity and Access Management (IAM), and AWS PrivateLink.
Learn more about EKS in our detailed blog posts:
Kubernetes on EC2 vs EKS
EKS is best suited for AWS, so it might be the best option if you are running Kubernetes on AWS. It is easy to set up and helps minimize your management burden. You can also run EKS on Outposts for on-premises workloads.
If you want more control, however, you can run Kubernetes on EC2 instances. This allows you to choose the tools and Kubernetes distribution that suit you. In contrast, EKS limits you to built-in tools and configurations.
Running Managed Containers on Amazon EC2 vs AWS Fargate
Amazon EKS supports two launch types: EC2 and Fargate. Containers managed as part of Kubernetes clusters can be deployed on either these services, or a combination of the two.
Running containers on EC2
You can run EKS clusters on top of regular Amazon Elastic Compute Cloud (EC2) instances. This gives you more control over customization of the infrastructure. For example, you can select specific types of instances, such as memory-optimized instances, or instances with graphics acceleration.
However, this also means you are responsible for patching, networking, and securing your environment, and monitoring instances to ensure they are properly utilized.
The price of an EC2-based launch type is fixed per hour, with the memory, CPU, and other hardware resources included in the instance type. You pay the full instance cost, no matter how many containers the instance actually runs.
Running containers on Fargate
Alternatively, you can use Amazon Fargate to launch Amazon EKS instances. EKS communicates with Fargate to run and manage containers. This saves the complexity and overhead of configuring and managing EC2 instances for your Kubernetes clusters. Fargate also improves security, by isolating resources for each application.
In terms of pricing, Fargate prices are generally closer to resource requirements. Fargate workloads are priced according to the CPU and memory used by individual containers, and AWS manages the deployment of containers across the infrastructure.
Below a certain threshold, Fargate offers more cost-effective pricing over EC2-based deployment. managing your own set of EC2s is more cost-effective than using Fargate.
Comparing EC2 vs. Fargate pricing for containerized workloads
When comparing Amazon EC2 and Fargate, both services may be more cost effective, depending on your scenario.
As shown in the graph below, the cost advantage of Fargate is not dependent on the pricing plan, but is strongly affected by CPU and memory reservation rates. The higher the utilization of an EC2 instance, the more cost effective EC2 becomes. The lower the utilization, the more cost effective Fargate will be.
Image Source: AWS
The AWS Kubernetes Alternative: Amazon Elastic Container Service (AWS ECS)
ECS is a container management service that facilitates the management of multiple containers in a cluster. ECS is not based on Kubernetes - it is a simple, lightweight alternative you can use to orchestrate container workloads.
You can run, stop and maintain a number of containers (defined as “tasks”) within a grouping of tasks known as a “service”. You can use either a serverless infrastructure, which is managed by AWS Fargate, or manage your own cluster of Amazon EC2 instances, which gives you more control over your infrastructure.
Amazon ECS provides two schedulers that deploy containers in clusters. ECS schedulers allow you to:
- Deploy containers according to availability requirements or computing needs (RAM, CPU, etc.).
- Schedule long-running applications or services and batch jobs.
- Integrate AWS Blox (an open-source container orchestration tool) with Amazon ECS to schedule containers or, alternatively, use a third-party scheduling option supported by ECS.
ECS supports Docker so you can use Docker containers across EC2 instance clusters. Each instance runs a Docker daemon, which can deploy any application that is packaged as a container—either on Amazon ECS or locally—without the need to alter the container.
ECS also supports Docker networking, allowing you to integrate with Amazon Virtual Private Cloud (Amazon VPC) to isolate containers. You control the interactions of your containers with external traffic and services.
You launch a cluster of container instances, specifying your desired tasks, and allow Amazon ECS to handle the management. ECS can install and operate:
- Cluster management software
- Configuration management systems
- Monitoring systems
- Infrastructure to manage the scalability and availability of each system
Kubernetes on EC2 vs ECS
Here are some of the key differences between deploying Kubernetes on EC2 and ECS.
ECS characteristics include:
- Better integration with other Amazon cloud services
- Cannot be extended into other clouds
- Does not support directly transferring hosted workloads to other locations (except for an AWS Outposts environment installed on-premises) -- however containers are portable, so you can easily migrate them to other platforms
Kubernetes characteristics include:
- Open-source platform, available on any major public clouds
- Can run on premises and outside of AWS
- Supported by a large and dynamic open-source community, providing extra features such as add-ons and extensions that are not available with ECS.
Learn more in our blog post: AWS ECS vs Kubernetes: An Unfair Comparison?
Optimizing Kubernetes Storage with Cloud Volumes ONTAP
NetApp Cloud Volumes ONTAP, the leading enterprise-grade storage management solution, delivers secure, proven storage management services on AWS, Azure and Google Cloud. Cloud Volumes ONTAP capacity can scale into the petabytes, and it supports various use cases such as file services, databases, DevOps or any other enterprise workload, with a strong set of features including high availability, data protection, storage efficiencies, Kubernetes integration, and more.
In particular, Cloud Volumes ONTAP supports Kubernetes Persistent Volume provisioning and management requirements of containerized workloads
Learn more about how Cloud Volumes ONTAP helps to address the challenges of containerized applications in these Kubernetes Workloads with Cloud Volumes ONTAP Case Studies.