0% found this document useful (0 votes)
13 views7 pages

Hamza Phase 4

This document outlines the establishment of a CI/CD pipeline for automated deployments of a To-Do List Web Application using IBM Cloud services. It details the steps for containerization, configuration of IBM Cloud Kubernetes and Container Registry, and the deployment process, including the creation of Dockerfiles and YAML files for Kubernetes. Additionally, it discusses automation through GitHub Actions and suggests future enhancements like autoscaling and advanced CI/CD integration.

Uploaded by

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

Hamza Phase 4

This document outlines the establishment of a CI/CD pipeline for automated deployments of a To-Do List Web Application using IBM Cloud services. It details the steps for containerization, configuration of IBM Cloud Kubernetes and Container Registry, and the deployment process, including the creation of Dockerfiles and YAML files for Kubernetes. Additionally, it discusses automation through GitHub Actions and suggests future enhancements like autoscaling and advanced CI/CD integration.

Uploaded by

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

PHASE 4: Establishing a CI/CD Pipeline for Automated

Deployments
College Name: KCT Engineering College, Kalaburgi

Group Members:

• Name: Mohammad Ali Hamza


CAN ID Number: CAN_32962430

• Name: Mohd Zaid


CAN ID Number: CAN_33915533

• Name: Mohd Rehan


CAN ID Number: CAN_32969093

1. Overview of CI/CD Pipeline for Automated Deployment

This phase focuses on automating the build, test, and deployment process of the To-Do List
Web Application using IBM Cloud Kubernetes Service (IKS) and IBM Cloud Container
Registry (ICR). The goal is to create a continuous integration and continuous deployment
(CI/CD) pipeline that ensures efficient, reliable, and scalable application deployment.

Key Components:

• Containerization: Package the application into Docker containers for consistent and
portable deployments.

• IBM Cloud Container Registry: Store and manage container images securely.

• IBM Kubernetes Service (IKS): Orchestrate container deployment, scaling, and


management.

• Automation & CI/CD: Automate the build, push, and deployment pipeline for rapid
and consistent application updates.

2. Configuring IBM Cloud Kubernetes and Container Registry

Steps to Set Up IBM Cloud Kubernetes Service (IKS):

1. Create an IBM Cloud Account & Log In:

o Visit IBM Cloud and log in with your credentials.


o If you don’t have an account, create one and set up billing.

2. Provision the Kubernetes Cluster:

o From the IBM Cloud Dashboard, navigate to Kubernetes.

o Click Create Cluster and select your desired Region and Cluster
Plan (Standard or Free).

o Choose the worker node type (e.g., Standard, Compute).

o Once the cluster is created, configure kubectl to manage the cluster:

ibmcloud ks cluster config --cluster <cluster-name>

Integrate IBM Cloud Container Registry (ICR):

1. Create a Namespace:

o Navigate to Container Registry from the IBM Cloud Dashboard.

o Create a private registry for storing your container images.

o Note your Registry URL and Credentials for authentication.

2. Enable Image Vulnerability Scanning:

o Enable vulnerability scanning for pushed images:

ibmcloud cr policy-update --scan-on-push true

3. Containerizing the To-Do List Application

Step 1: Create Dockerfiles

1. Frontend Dockerfile (/public/Dockerfile):

FROM node:16-alpine

WORKDIR /app

RUN npm install

EXPOSE 3000

CMD ["npm", "start"]


2. Backend Dockerfile (/server/Dockerfile):

FROM node:16-alpine

WORKDIR /app

RUN npm install

EXPOSE 5000

CMD ["node", "server.js"]

Step 2: Build Docker Images

• Build the Docker images:

docker build -t frontend-app:1.0 ./public

docker build -t backend-app:1.0 ./server

Step 3: Push Docker Images to IBM Cloud Container Registry

docker tag frontend-app:1.0 <region>.icr.io/<namespace>/frontend-app:1.0

docker tag backend-app:1.0 <region>.icr.io/<namespace>/backend-app:1.0

1. Push the Images:

docker push <region>.icr.io/<namespace>/frontend-app:1.0

docker push <region>.icr.io/<namespace>/backend-app:1.0

4. Deploying the Application on IBM Kubernetes Service

Step 1: Create Kubernetes Deployment and Service YAML Files

1. Frontend Deployment (frontend-deployment.yaml):

apiVersion: apps/v1

kind: Deployment

metadata:

name: frontend-deployment

spec:

replicas: 3

selector:
matchLabels:

app: frontend

template:

metadata:

labels:

app: frontend

spec:

containers:

- name: frontend

image: <region>.icr.io/<namespace>/frontend-app:1.0

ports:

- containerPort: 3000

2. Backend Deployment (backend-deployment.yaml):

apiVersion: apps/v1

kind: Deployment

metadata:

name: backend-deployment

spec:

replicas: 2

selector:

matchLabels:

app: backend

template:

metadata:

labels:

app: backend

spec:

containers:
- name: backend

image: <region>.icr.io/<namespace>/backend-app:1.0

ports:

- containerPort: 5000

3. Service YAML (service.yaml):

apiVersion: v1

kind: Service

metadata:

name: frontend-service

spec:

type: NodePort

selector:

app: frontend

ports:

- port: 3000

targetPort: 3000

Step 2: Apply YAML Files

• Deploy the application:

kubectl apply -f frontend-deployment.yaml

kubectl apply -f backend-deployment.yaml

kubectl apply -f service.yaml

Step 3: Verify Deployment

• Check running pods:

kubectl get pods

• Check services:

kubectl get svc


5. Automating the Deployment with CI/CD Pipeline

Step 1: Set Up GitHub Actions

1. Create a Workflow File (.github/workflows/ci-cd.yml):

name: CI/CD Pipeline

on:

push:

branches:

- main

jobs:

build:

runs-on: ubuntu-latest

steps:

- name: Checkout code

uses: actions/checkout@v2

- name: Build Docker Images

run: |

docker build -t frontend-app:1.0 ./public

docker build -t backend-app:1.0 ./server

- name: Push to IBM Cloud Container Registry

run: |

docker tag frontend-app:1.0 <region>.icr.io/<namespace>/frontend-app:1.0

docker tag backend-app:1.0 <region>.icr.io/<namespace>/backend-app:1.0

docker push <region>.icr.io/<namespace>/frontend-app:1.0

docker push <region>.icr.io/<namespace>/backend-app:1.0

- name: Deploy to Kubernetes

run: |

kubectl apply -f frontend-deployment.yaml

kubectl apply -f backend-deployment.yaml


kubectl apply -f service.yaml

6. Future Enhancements

• Enable Autoscaling: Implement Kubernetes Horizontal Pod Autoscaler to


automatically scale the application based on demand.

• Integrate Advanced CI/CD Pipelines: Use Jenkins or Tekton Pipelines for more
advanced CI/CD capabilities.

• Add Automated Vulnerability Scanning: Integrate vulnerability scanning into the


CI/CD pipeline to ensure secure Docker images.

https://github.com/ALIHAMZA13/ToDoList.git

You might also like