0% found this document useful (0 votes)
2 views

Cloud_020&027_review1

Uploaded by

studylets138
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Cloud_020&027_review1

Uploaded by

studylets138
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Managing and deploying a

microservices-based voting
application - REVIEW 1

SHREYA. R {RA2211028010020}
CHANCHAL VISHWAKARMA {RA2211028010027}

Guide: Dr. R. Radhika


PROBLEM STATEMENT
Managing and deploying a microservices-based voting application manually is slow
and error-prone. Key challenges include:

- Manually building microservices can cause errors and inconsistencies.


- Without automation, updates take longer and may introduce bugs.
- Pushing and tracking images manually is inefficient.
- Without Kubernetes automation, handling high traffic is difficult.
APPLICATION TO BE DEPLOYED: VOTING APP
Voting Page Results Page
APPLICATION TECH STACK + ARCHITECTURE
• A front-end web app in Python which lets you vote between two options
• A Redis which collects new votes
• A .NET worker which consumes votes and stores them
• A Postgres database
• A Node.js web app which shows the
results of the voting in real time
INFRASTRUCTURE
1
1️⃣ GitHub → Stores source code

2️⃣ AWS CodePipeline → Automates CI/CD

3️⃣ AWS CodeBuild → Builds Docker images

4️⃣ Amazon ECR → Stores Docker images

5️⃣ K3s on AWS EC2 (Free Tier) → Runs Kubernetes cluster

6️⃣ Argo CD → Automates deployment to K3s


HOW INFRASTRUCTURE WORKS?
11️⃣ Developers push code to GitHub, which acts as the central version control system for
managing the application's source code.
2️⃣ AWS CodePipeline automatically detects changes in the GitHub repository and
triggers the CI/CD process.
3️⃣ AWS CodeBuild pulls the latest code, builds the application, creates Docker
images, and pushes them to Amazon Elastic Container Registry (ECR).
4️⃣ Amazon ECR securely stores the Docker images, making them available for
deployment.
5️⃣ K3s, a lightweight Kubernetes distribution running on an AWS EC2 Free Tier
instance, retrieves the latest Docker images from ECR and deploys the microservices.
6️⃣ Argo CD continuously monitors GitHub and ECR, detects new updates, and
automatically deploys the latest application version to K3s, ensuring a seamless and automated
deployment process.
ARCHITECTURE
CREATION OF INFRASTRUCTURE
1. Set Up an AWS EC2 Instance for K3s
2. INSTALL AND CONFIGURE K3s ON EC2
3. CREATING CONTAINER REGISTRIES ON ECR
4. SETUP PIPELINES AND CODEBUILD

VOTE - CODEBUILD VOTE-PIPELINE


4. SETUP PIPELINES AND CODEBUILD

WORKER - CODEBUILD WORKER-PIPELINE


4. SETUP PIPELINES AND CODEBUILD

RESULT - CODEBUILD RESULT-PIPELINE


IaC Implementation Using AWS
CloudFormation
• Automates EC2 setup for K3s (so you don’t have to configure it manually).
• Creates Amazon ECR repositories for Docker images.
• Configures AWS CodePipeline to automate builds and deployments.
• Sets up IAM roles & permissions for CodePipeline and CodeBuild.
This can also be achieved by using terraform.
# EC2 Instance for K3s CodePipelinePermissions Provider: CodeBuild
K3sEC2Instance: PolicyDocument: # AWS CodePipeline Version: "1"
Type: AWS::EC2::Instance Version: "2012-10-17" VotingAppPipeline: InputArtifacts:
Properties: Statement: Type: AWS::CodePipeline::Pipeline - Name: SourceOutput
InstanceType: t2.micro - Effect: Allow Properties: OutputArtifacts:
ImageId: ami-0c55b159cbfafe1f0 # Action: Name: voting-app-pipeline - Name: BuildOutput
Update with latest Ubuntu AMI ID - s3:* RoleArn: !GetAtt Configuration:
KeyName: your-key-pair - codebuild:* CodePipelineRole.Arn ProjectName: vote-build
SecurityGroupIds: - ecr:* Stages: - Name: Deploy
- !Ref K3sSecurityGroup - iam:PassRole - Name: Source Actions:
Tags: - ec2:* Actions: - Name: DeployAction
- Key: Name Resource: "*" - Name: SourceAction ActionTypeId:
Value: "K3s-Server" ActionTypeId: Category: Deploy
# ECR Repositories Category: Source Owner: AWS
# IAM Role for CodePipeline VoteECR: Owner: ThirdParty Provider: CodeDeploy
CodePipelineRole: Type: AWS::ECR::Repository Provider: GitHub Version: "1"
Type: AWS::IAM::Role Properties: Version: "1" InputArtifacts:
Properties: RepositoryName: vote Configuration: - Name: BuildOutput
RoleName: CodePipelineRole Owner: "shreya-ghub" Configuration:
AssumeRolePolicyDocument: WorkerECR: Repo: "voting-app" ApplicationName: vote-app
Version: "2012-10-17" Type: AWS::ECR::Repository Branch: "main" DeploymentGroupName: vote-
Statement: Properties: OutputArtifacts: deployment-group
- Effect: Allow RepositoryName: worker - Name: SourceOutput
Principal: - Name: Build Outputs:
Service: ResultECR: Actions: K3sEC2PublicIP:
[codepipeline.amazonaws.com] - Name: BuildAction Description: "Public IP of the K3s
Type: AWS::ECR::Repository
Action: sts:AssumeRole ActionTypeId: Server"
Properties:
Policies: Category: Build Value: !GetAtt
RepositoryName: result K3sEC2Instance.PublicIp
- PolicyName: Owner: AWS
IAM ROLES
SUMMARY

Components Details

Users 2-5 internal users, scalable end-users

Services 1 EC2 instance running K3s (multiple containers)

AWS Services EC2, CodePipeline, CodeBuild, ECR

CI/CD Tools GitHub, Docker, K3s, Argo CD

Microservices Vote (Python), Worker (.NET), Result (Node.js)

Roles & Responsibilities Developers, DevOps, QA/Testers, Project Manager

You might also like