AWS Fargate is a serverless compute engine for containers that allows you to run containers without managing the underlying infrastructure. With Fargate, you can focus on building and running your applications in containers without the need to provision, configure, or scale the underlying compute resources.

Key features of AWS Fargate:

Serverless Compute for Containers:

Fargate abstracts away the complexity of managing servers, enabling you to deploy and run containerized applications without dealing with the underlying infrastructure. This serverless approach simplifies the container orchestration process.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

Container Orchestration Integration:

Fargate seamlessly integrates with popular container orchestration services, such as Amazon ECS (Elastic Container Service) and Amazon EKS (Elastic Kubernetes Service). This allows you to use familiar tools and workflows for managing and orchestrating your containers.

Resource Scaling:

Fargate automatically handles the scaling of compute resources based on the resource requirements of your containers. You can specify CPU and memory requirements for each task, and Fargate ensures that the necessary resources are allocated.

Isolation and Security:

Fargate provides a level of isolation between containers running on the same cluster, ensuring security and preventing interference. Each task runs in its own dedicated kernel, and tasks do not share underlying compute resources.

Download Banner

Integrated Networking:

Fargate integrates with Amazon VPC (Virtual Private Cloud), allowing you to configure networking settings for your containers. This includes setting up private networks, security groups, and other networking features.

Persistent Storage:

Fargate supports the use of Amazon EFS (Elastic File System) and Amazon EBS (Elastic Block Store) for persistent storage needs. This allows containers to access and store data persistently across tasks.

Application Load Balancing:

Fargate integrates with AWS Application Load Balancer (ALB) and Network Load Balancer (NLB), making it easy to distribute incoming traffic across containers and maintain high availability.

Log Integration:

Fargate integrates with AWS CloudWatch Logs, enabling you to centralize and analyze logs generated by your containers. This facilitates monitoring and troubleshooting of your containerized applications.

Compatibility with Docker and Container Images:

Fargate supports standard Docker containers and is compatible with common container image formats. You can use your existing container images without modification.

Provisioning Fargate EKS cluster:

1. Let’s create a fargate cluster using eksctl.

[root@centos9 tmp]# eksctl create cluster –name bdr-fargate –fargate
2023-12-23 19:14:42 [ℹ] eksctl version 0.167.0
2023-12-23 19:14:42 [ℹ] using region us-east-2
2023-12-23 19:14:44 [ℹ] setting availability zones to [us-east-2c us-east-2a us-east-2b]
2023-12-23 19:14:44 [ℹ] subnets for us-east-2c – public:192.168.0.0/19 private:192.168.96.0/19
2023-12-23 19:14:44 [ℹ] subnets for us-east-2a – public:192.168.32.0/19 private:192.168.128.0/19
2023-12-23 19:14:44 [ℹ] subnets for us-east-2b – public:192.168.64.0/19 private:192.168.160.0/19
2023-12-23 19:14:44 [ℹ] using Kubernetes version 1.27
2023-12-23 19:14:44 [ℹ] creating EKS cluster “bdr-fargate” in “us-east-2” region with Fargate profile
2023-12-23 19:14:44 [ℹ] if you encounter any issues, check CloudFormation console or try ‘eksctl utils describe-stacks –region=us-east-2 –cluster=bdr-fargate’
2023-12-23 19:14:44 [ℹ] Kubernetes API endpoint access will use default of {publicAccess=true, privateAccess=false} for cluster “bdr-fargate” in “us-east-2”
2023-12-23 19:14:44 [ℹ] CloudWatch logging will not be enabled for cluster “bdr-fargate” in “us-east-2”
2023-12-23 19:14:44 [ℹ] you can enable it with ‘eksctl utils update-cluster-logging –enable-types={SPECIFY-YOUR-LOG-TYPES-HERE (e.g. all)} –region=us-east-2 – -cluster=bdr-fargate’
2023-12-23 19:14:44 [ℹ]
2 sequential tasks: { create cluster control plane “bdr-fargate”,
2 sequential sub-tasks: {
wait for control plane to become ready,
create fargate profiles,
}
}
2023-12-23 19:14:44 [ℹ] building cluster stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:14:45 [ℹ] deploying stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:15:15 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:15:46 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:16:47 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:17:48 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:18:49 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:19:50 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:20:51 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:21:52 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:22:53 [ℹ] waiting for CloudFormation stack “eksctl-bdr-fargate-cluster”
2023-12-23 19:25:01 [ℹ] creating Fargate profile “fp-default” on EKS cluster “bdr-fargate”

2023-12-23 19:29:21 [ℹ] created Fargate profile “fp-default” on EKS cluster “bdr-fargate”
2023-12-23 19:29:53 [ℹ] “coredns” is now schedulable onto Fargate
2023-12-23 19:30:59 [ℹ] “coredns” is now scheduled onto Fargate
2023-12-23 19:31:00 [ℹ] “coredns” pods are now scheduled onto Fargate
2023-12-23 19:31:00 [ℹ] waiting for the control plane to become ready
2023-12-23 19:31:00 [✔] saved kubeconfig as “/root/.kube/config”
2023-12-23 19:31:00 [ℹ] no tasks
2023-12-23 19:31:00 [✔] all EKS cluster resources for “bdr-fargate” have been created
2023-12-23 19:31:02 [ℹ] kubectl command should work with “/root/.kube/config”, try ‘kubectl get nodes’
2023-12-23 19:31:02 [✔] EKS cluster “bdr-fargate” in “us-east-2” region is ready
[root@centos9 tmp]#

2. Unlike traditional EKS clusters, you will not have any worker nodes in Fargate since its serverless for container workloads.

What is Fargate and How Does it Work With EKS

3. A default Fargate profile will be created as part of cluster creation.

What is Fargate and How Does it Work With EKS

4. For application workload, let’s create a new fargate profile and namespace.

[root@centos9 tmp]# eksctl create fargateprofile –cluster bdr-fargate –name frontend-profile –namespace frontend
2023-12-23 19:46:01 [ℹ] creating Fargate profile “frontend-profile” on EKS cluster “bdr-fargate”
2023-12-23 19:48:12 [ℹ] created Fargate profile “frontend-profile” on EKS cluster “bdr-fargate”
[root@centos9 tmp]#
[root@centos9 tmp]#
[root@centos9 tmp]# kubectl create namespace frontend
namespace/frontend created
[root@centos9 tmp]#

5. Create a new deployment manifest like below for nginx.

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: frontend
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
– name: nginx
image: nginx:1.14.2
ports:
– containerPort: 80

6. Create new deployment using the above manifest.

[root@centos9 tmp]# kubectl get all -n frontend
NAME READY STATUS RESTARTS AGE
pod/nginx-deployment-cbdccf466-9rglp 1/1 Running 0 59s
pod/nginx-deployment-cbdccf466-ffxtn 1/1 Running 0 59s

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx-deployment 2/2 2 2 60s

NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-deployment-cbdccf466 2 2 2 60s
[root@centos9 tmp]#

7. We might not have any visibility on the running EC2 instance on the console and AWS CLI. But we can describe the pod and see the node name.

[root@centos9 tmp]# kubectl describe pod/nginx-deployment-cbdccf466-9rglp -n frontend |grep Node
Node: fargate-ip-192-168-111-198.us-east-2.compute.internal/192.168.111.198

Fargate abstracts away infrastructure management, it also limits your ability to customize the underlying host. You cannot SSH into Fargate containers or customize the host environment.

Conclusion:

AWS Fargate is particularly suitable for organizations looking to simplify the deployment and management of containerized applications by adopting a serverless approach. It is well-suited for scenarios where you want to focus on application development and not worry about the underlying infrastructure, making it easier to achieve agility and scalability in your containerized workloads.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post