AWS EKS Deployment with GitHub Actions CI/CD
Documents a GitHub Actions CI/CD pipeline that builds, scans, and deploys a containerized app to AWS EKS with SonarCloud and Trivy.
What this file does
Documents a GitHub Actions CI/CD pipeline that builds, scans, and deploys a containerized app to AWS EKS with SonarCloud and Trivy.
When to use it
- Setting up a CI/CD pipeline for a containerized app on AWS EKS
- Integrating SonarCloud code quality checks into a deployment workflow
- Adding Trivy security scanning to a Docker image build pipeline
- Learning how to push images to Amazon ECR and deploy with kubectl
Assumes this stack
AWS EKS Deployment with GitHub Actions CI/CD
This repository demonstrates a CI/CD pipeline for deploying a containerized application to Amazon Elastic Kubernetes Service (EKS) using GitHub Actions. The pipeline incorporates SonarCloud for code quality checks, Trivy for security scans, and Amazon ECR for container image storage.
Features
- CI/CD Pipeline: Automates building, testing, and deploying the application.
- Code Quality Analysis: Uses SonarCloud to ensure code meets quality standards.
- Security Scanning: Implements Trivy to identify vulnerabilities in Docker images.
- AWS Integration: Pushes container images to Amazon ECR and deploys to Amazon EKS.
- Infrastructure as Code: Deploys Kubernetes resources via
kubectl.
Workflow Overview
Below is a breakdown of the CI/CD pipeline with images illustrating each step.
1. Checkout Code
The first step pulls the latest code from the repository using the actions/checkout GitHub Action.
2. SonarCloud Analysis
Scans the codebase for issues like bugs, vulnerabilities, and code smells.
3. Trivy Scan
Scans the built Docker image for vulnerabilities to ensure secure deployments.
4. Push Image to Amazon ECR
Pushes the Docker image to Amazon Elastic Container Registry (ECR).
5. AWS cli configure
Builds a Docker image of the application and tags it using the commit SHA.
5. Create cluster for kubernetes deployment
eksctl create cluster \
--name actions-eks-cluster \
--region us-east-1 \
--nodes 1 \
--nodegroup-name actions-eks \
--node-type t3.medium \
--nodes-min 1 \
--nodes-max 3 \
--managed
Explanation of Flags
-
--name actions-eks-cluster:- Specifies the name of the EKS cluster.
-
--region us-east-1:- Sets the AWS region for your EKS cluster.
-
--nodes 1:- Sets the initial number of nodes for the cluster.
-
--nodegroup-name actions-eks:- Names the node group for easier management.
-
--node-type t3.medium:- Specifies the EC2 instance type for the nodes in the cluster.
t3.mediumis cost-effective and sufficient for light workloads.
- Specifies the EC2 instance type for the nodes in the cluster.
-
--nodes-min 1:- Sets the minimum number of nodes in the node group.
-
--nodes-max 3:- Sets the maximum number of nodes in the node group for scaling.
-
--managed:- Enables AWS-managed node groups, which simplifies lifecycle management of nodes.
Verify Cluster Creation: After running the command, check the status of your cluster:
eksctl get cluster --region us-east-1
or
eksctl get cluster --name actions-eks-cluster
8.
it listens on port 3000 so we open port 300 from our load balancer and access on the external ip
- Deployed Application
Conclusion
This project demonstrates a complete CI/CD pipeline for deploying containerized applications to AWS EKS. It incorporates robust practices like code quality checks and security scans to ensure reliable and secure deployments.
What's inside
8 sections, 1 bash command with flag explanations, 6 screenshots, and a conclusion
Change this for your project
- Replace
actions-eks-clusterwith your own EKS cluster name - Replace
us-east-1with your target AWS region - Replace
t3.mediumwith your desired EC2 instance type
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Combining SonarCloud and Trivy in the same pipeline for quality and security gates
- Using eksctl with managed node groups for simplified cluster creation
Related Documents
SVI 2.0
Documents the SVI LoRA family for WanVideo I2V, covering version history, usage patterns, known limitations, and community workflows.
第一章 模型预处理
> 译者:[muxuezi](https://muxuezi.github.io/posts/1-premodel-workflow.html)
TVM: An Automated End-to-End Optimizing Compiler for Deep Learning
Describes TVM, a compiler that optimizes deep learning models for diverse hardware back-ends using graph-level and operator-level transformations.
Content Workflow
Defines a 6-stage content production pipeline with automated quality scoring and self-healing gates that enforce an 8.0 minimum score across four dimensions.