CI/CD Pipeline for Dockerized Applications

Lakshmanan Samynathan
3 min readApr 6, 2022

--

Kubernetes is becoming de-facto standard for containerized applications and it is important to be aware and get yourself familiarized with of CI/CD Pipeline for Dockerized Applications. I have created the CI/CD Pipeline Using AWS, Jenkins and EKS as major components.

Infrastructure Setup

Account A (CI Account)

Below instances are created using persistent spot request. This spot instances can be stopped and started ($$ Savings)

  • Jenkins Server ( t2.small )
  • SonarQube Server (t2.large)

Account B (EKS Account)

EKS Cluster provisioned with Terraform and Running Spot Node Group (t3a.large)

Pipeline Architecture

  1. GitHub Repo with Simple Application Code / Jenkinsfile / Docker File / Helm Chart etc.
  2. GitHub WebHooks triggers the Jenkins Job on Commit to the Repo.
  3. Unit Testcases are Run and Static application Security Testing (SAST) is carried out with SonarQube.
  4. Docker Image is Built/Tagged (Using commit hash) and Pushed to ECR.
  5. Jenkins CI server Assumes Cross Account Role to connect to EKS account .
  6. Helm Lint is performed and Helm packaging is done.
  7. Application deployed in EKS Cluster with Rolling Update Deployment Strategy
  8. Email and Slack Notification is sent upon Successful/Failure of Jenkins Pipeline .

Features

  1. AWS EC2 Spot instances for Compute (Jenkins/Sonar)
  2. Route53 used for DNS (mytwocents.click for Jenkins/Sonar and ramsawswork.click for Application in EKS and ingress)
  3. Cross Account Access using IAM Role
  4. Amazon Certificate Manager (ACM) is used to Secure the Application deployed in EKS
  5. Zero-Downtime Deployment with EKS
  6. Readiness/Liveness probes and Pod CPU/Memory Requests and Limits set.
  7. Ingress enabled in EKS so multiple applications can be hosted and routed seamlessly
  8. Pod Autoscaling is Setup with Horizontal Pod Autoscaler (HPA) with Scaling Criteria of CPU-Percentage > 50%

GitHub Repo Link

Jenkins Pipeline

SonarQube Scan Results

ECR Repository

EKS Cluster

Pod Auto Scaling Setup

Application exposed via Ingress

Homepage

Health Check Page

Slack Notification

Email Notification

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Responses (2)

Write a response