Ch10
Containers🔗
The problems of Monolithic Application
- Unnecessary scaling of unused component
- Containers differ from VMs becuase it is always same under the effect of some config file that creates the image, no matter what Host OS is. Container Enginer (Docker) is responsible for this. While VMs can be quite large in size, and can be platform/host OS dependent.
- Hypervisor can help orchestrate bunch of VMs
- ECS (based on Docker) is container Orchestration Platform
2 Ways to setup
- EC2 with docker engine installed on them and works as Cluster.
- Amazon Fargate : serverless platform, not always on (Sleep)
Amazon Elastic Container Registry (ECR)🔗
- Fully managed docker container registry, built in Amazon ECS
- helps in hosting images with bunch of nice features
- To run container on EC2, we will need Task Definitions
- Task Definitions (Important, asked in my exam lol)
- Configuring Memory Limits
- Network Details : ports mapping etc
- Container Details : names, tagging
- ECS Service : allows to manage, run, maintain a specific number of task definitions within an amazon ECS Cluster.
- Self Healing Clusters
- Allows to setup ELB in front of Containers
When should we use Serverless v/s ECS
Servered | Serverless |
---|---|
Workload supports long-running operations | Cost Effective |
Fully Utilizes the CPU and Memory | Lower Development Cost |
Reduced Operational Cost | |
Better Scalability |
Fargate is always using AWS VPC mode network while ECS gives flexibility to use any mode.
Three Networking Modes
- HOST Mode
- AWS VPC Mode
- Bridge Mode
ECS for Kubernetes🔗
- Kubernetes is open-source container orchestration tool designed to automate, deploy, scale and operate containerised application.
- It can grow from tens, thousands or even millions of containers
- Its container runtime agnostic
EKS (ECS for Kubernetes)🔗
- Managed service allowing you to run Kubernetes across your AWS Infra without having to take care provisioning and running Kubernetes Management Infrastructure in Control Plane
- You only need to provision and maintain the Worker Nodes
Control Plane : # of different APIs. The Kubelet processes Kubernetes Master.
- Schedules container onto nodes
- Tracks state of all containers
**Nodes ** : EC2 Instances
Working with EKS🔗
- Create an EKS Service Role
- Create an EKS Cluster VPC
- Install kubectl and IAM Authenticator
- Create your EKS Cluster
- Configure Kubectl for EKS
- Configure and provision worker nodes
- Configure Worker nodes to join EKS Cluster