Skip to content

BiancaCostache/cd12355-microservices-aws-kubernetes-project-starter

 
 

Repository files navigation

Scaling Microservices with AWS, Docker, and Kubernetes

This project demonstrates how to deploy and manage microservices in a cloud-native environment using Kubernetes on AWS. The objective is to establish a scalable, reliable, and high-performing architecture capable of supporting microservices at scale.

Prerequisites:

Local Setup

  • Python 3.6+ Environment: Run Python applications and manage dependencies with pip.
  • Docker CLI: Build and test Docker containers locally.
  • kubectl: Interface with Kubernetes clusters to manage deployments.
  • helm: Utilize Helm Charts to simplify Kubernetes resource management.

Cloud Resources

  • AWS CodeBuild: Automate Docker image builds as part of a CI pipeline.
  • AWS ECR: Serve as a repository for storing Docker images.
  • Amazon EKS: Host and manage Kubernetes clusters for application deployment.
  • AWS CloudWatch: Track logs and monitor cluster activity.
  • GitHub: Repository for source code and configuration files.
  • Docker: Containerization tool for packaging and running applications.

Project Goals:

  1. Define a Dockerfile for the Python application, leveraging an appropriate base image.
  2. Configure AWS CodeBuild to build and push Docker images to AWS ECR.
  3. Deploy a PostgreSQL database using Helm Charts.
  4. Use Kubernetes manifests to define and deploy the microservices architecture.
  5. Monitor application activity using AWS CloudWatch.

Workflow Overview:

1. Source Code Management (GitHub)

The application's source code is maintained in a GitHub repository. Webhooks trigger events like build processes upon merging pull requests.

2. Continuous Integration (AWS CodeBuild)

  • A CI pipeline built with AWS CodeBuild handles the automated creation of Docker images.
  • A buildspec.yml file orchestrates the process, including:
    • Authenticating with AWS ECR.
    • Building and tagging Docker images.
    • Pushing the images to ECR for storage.

3. Docker Image Hosting (AWS ECR)

  • Docker images are stored in AWS Elastic Container Registry (ECR), ensuring secure and centralized access for deployment.

4. Application Deployment (Amazon EKS)

  • The Kubernetes cluster is provisioned using Amazon EKS. The cluster includes a node group with two Amazon Linux 2 instances.
  • Deployment workflow:
    • Connect to the EKS cluster using aws eks update-kubeconfig.
    • Kubernetes pulls the latest Docker images from ECR based on deployment configurations.
    • Deployments, services, and other resources are defined in YAML files to ensure proper application management and scaling.
    • Rolling updates are automatically handled by Kubernetes to minimize downtime during updates.

5. Application Monitoring (AWS CloudWatch)

  • Logs generated by application pods are sent to AWS CloudWatch for centralized monitoring and debugging.

Deployment Documentation

The deployment process is designed to provide a clear and efficient way to release updates while offering insight into the tools and technologies used. Here’s how an experienced developer can deploy changes:

Understanding the Workflow

  1. GitHub Integration: The repository acts as the central source for application code and configuration files. Developers should push their changes to feature branches and merge them into the main branch through pull requests. Each merge triggers the CI/CD pipeline.

  2. AWS CodeBuild Pipeline: CodeBuild automatically handles Docker image creation and updates. Developers should ensure the buildspec.yml file reflects any necessary updates for their changes.

  3. Kubernetes Deployment Configuration: Update the Kubernetes YAML files to include new services, deployments, or configuration changes. The YAML files specify the desired application state within the cluster.

Releasing New Builds

  • Push changes to the main branch on GitHub to initiate the CI pipeline.
  • CodeBuild creates and tags the updated Docker image, then pushes it to AWS ECR.
  • Kubernetes, configured to pull the latest image from ECR, automatically updates the running pods based on the deployment configuration.
  • Monitor the deployment process and logs via AWS CloudWatch to verify successful updates.

This process ensures seamless updates with minimal downtime, leveraging the strengths of Kubernetes and AWS for scalable microservices management.


Continuous Deployment Process:

This system integrates GitHub, AWS CodeBuild, AWS ECR, and Kubernetes (via Amazon EKS) to achieve automated deployment. Here's the flow:

  1. Code changes are pushed to GitHub, triggering the CI pipeline.
  2. AWS CodeBuild creates a Docker image and pushes it to AWS ECR.
  3. Kubernetes automatically detects the new image and updates the running pods via a rolling update.

This end-to-end automation ensures your microservices are always running the latest version with minimal human intervention.


This approach demonstrates how to scale, deploy, and maintain microservices effectively in a cloud-native environment using Kubernetes and AWS services.

About

cd12355 project: Coworking Space Service Project Starter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.2%
  • Dockerfile 10.8%