Compare solutions: Kubernetes and AWS ECS

Maciej
6 min readApr 27, 2021

Introduction

Using containers offers great benefits, increasing the environment also means making difficult choices. We need to think what orchestration tools are the best for our situation and how to monitor the our system. Docker is the standard for container runtimes, but you have multiple options to choose from from container orchestration tools. For now Leaders in this case there are CNCF’s Kubernetes and AWS ECS. According to a 2020 survey, 83% of companies use Kubernetes as their container orchestration solution.

More info we can find in this survey

In this article, I will focus to compare ECS and Kubernetes to help users decide which one to use.

Kubernetes — Benefits of using for container orchestration

Kubernetes is an active community with a wide range of modular open source extensions, backed by major companies and institutions like CNCF. Many developers and many large companies have contributed to Kubernetes, making it the perfect platform for modern software infrastructure. This also means that the community is not only actively working together, but is also building features to easily solve modern problems.

When presenting Kubernetes , we should focus on below aspects:

Fully open source

Kubernetes can be used on both cases on-premises or in the cloud without rebuilding your container orchestration strategy. The software is completely open source and can be redeployed without incurring traditional software license fees. You can also run Kubernetes clusters in both public and private clouds to provide a layer of virtualization between public and private resources.

Strong flexibility

If we have some critical service/application that generates revenue, Kubernetes is a great way to fulfillment of requirements high availability without sacrificing the need for efficiency and scalability. Kubernetes gives us fine-grained control over how your workload is scaled. This avoids vendor lock-in by AWS ECS or other container services if you need to switch to a more powerful platform.

High availability

Kubernetes is designed to address the availability of both applications and infrastructure, making it essential when deploying containers in production. With health checks kubernetes protects containerized applications from failures by constantly checking the health of nodes and containers. Kubernetes also offers two additional mechanism like self-healing and auto-replacement. If a container or pod crashes due to an error, Kubernetes will take care of it.

Another thing that kubernetes provides is traffic routing and load balancing. Traffic routing sends requests to the appropriate containers, but Kubernetes also has a built-in load balancer to distribute the load across multiple pods, allowing you to quickly redistribute resources for outages, peak or accidental traffic, and batch processing. You can also use an external load balancer.

Scalability Workload

Kubernetes is known to be efficient in using infrastructure resources and offers some useful features for scaling purposes like (Horizontal Infrastructure Scaling, Replication Controller, Manual and Autoscaling).

  1. Horizontal Infrastructure Scaling: Kubernetes works at the individual server level and implements horizontal scaling. You can easily add or remove new servers.
  2. Replication Controller: This controller ensures that the specified number of equivalent pods are running in the cluster. If there are too many pods, the Replication Controller will terminate the extra pods, but if the number is too small, more pods will be started.
  3. Manual and Autoscaling: Autoscaling allows you to automatically change the number of running containers based on CPU utilization or other application-provided metrics, but if we use manual we need manually scale the number of running containers using commands or interfaces.

Designed For Deployment

The Main benefits of containerization is the ability to speed up the process of building, testing, and releasing software. Kubernetes is designed for deployment and offer some useful features like: Automatic rollout/rollback, Canary Deployment.

  1. Automatic rollout/rollback: Let’s imagine so you like to roll out a new version of your app or update your configuration. Kubernetes monitors the condition of the container during the rollout and processes it with no downtime. If it fails, it rolls back automatically.
  2. Canary deployment: Allow you to test a new deployment in production in parallel with an earlier version before scaling up the new deployment and at the same time scaling down the previous deployment.

Service Discovery

Very important thing that all services have a predictable way to communicate with each other. Within Kubernetes, containers are created and destroyed many times, so certain services may not exist permanently in a particular location. In typical way you had to create some service registry and adapt it to your application logic to keep track of the location of each container, but Kubernetes has a concept of native services that groups pods and simplifies service discovery. Kubernetes provides an IP address for each pod, assigns a DNS name to each set of pods, and then load-balances traffic to the pods in the set. This creates an environment where service discovery can be abstracted from the container level.

Network policy

In Kubernetes all pods can communicate with each other, but administrators can declaratively apply some network policies, which can restrict access to specific pods or namespaces. Basic network policy restrictions can be applied by simply specifying the name of the pod or namespace that you also specify for the output and input capabilities of a particular pod.

AWS ECS — Benefits of using for container orchestration

Traditional ECS

Gives you basic control over your container’s EC2 computing options. This flexibility means that we can choose the instance type that will run your workload. It also connects to other AWS services used to monitor and log activity on those EC2 instances.

Fargate ECS

Fargate ECS, its a good way to run containers without managing the underlying EC2 computing. Instead, Fargate automatically calculates the required CPU and memory requirements. Basically Fargate is a good option when you need to get your workload up and running quickly and you don’t want to bother with calculating and understanding the underlying computational options.

Good solution for small workloads

I think so ECS is a good choice if you plan to run small workloads that are not expected to grow significantly, task definitions are easy to register and understand.

Less complex application architecture

If you have an application that consists of only a few microservices and runs more or less independently, and the overall architecture is not very complex then ECS is a good choice in this case.

Simpler learning curve

Kubernetes has a steep learning curve, this is the main reason why Hosted kubernetes is so successful compared to traditional Kubeadm and KOPS flavors. Plus, with products like ECS Fargate, you don’t even have to worry about the underlying host because AWS will handles this.

Easy log & monitoring

We can easy integrate ECS with AWS Cloudwatch monitoring and logging. If you use container workloads in ECS, no additional work is required to configure the visibility of the container workloads.

Summary

Understanding the Kubernetes is a key factor in getting started, as providing an end-to-end solution requires the inclusion of a variety of other technologies and services, but the state of each supplementary technology is very different.

Mainly we should understand the difference between features and projects, that’s not the only challenge, finding advice on how to manage your project’s lifecycle can help, but it doesn’t resolve the confusion that arises when distinguishing between Kubernetes features and Kubernetes community projects. Open source technologies like Kubernetes is that the user community can create and share innovative uses. Special interest groups can develop features that will be added to the core Kubernetes, but other standalone projects are outside the core. Projects provided by individual developers or vendors may not be ready for prime time. In fact, many are at different stages of development.

I think so Kubernetes, is still a leader for container orchestration. To be honest, Kubernetes is clearly the winner. Kubernetes has become the de facto standard for container orchestration, so large and small organizations are investing heavily in resources to adopt it. AWS ECS is a good option, but sometimes it’s not enough. With the right toolchain, Kubernetes adoption is not only seamless, but it’s also truly cloud-native, which will help in the future.

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.