This project demonstrates the deployment of a Node.js application from the Node.js GitHub repository to a local Kubernetes cluster. The deployment uses ArgoCD for continuous delivery. Additionally, a Jenkins pipeline is set up to automate the build and deployment process, including Dockerization and testing.
Before proceeding, ensure you have the following setup:
- Two Virtual Machines (VMs)
- One VM for Jenkins with Docker installed.
- One VM for Minikube and kubectl.
- Minikube installed on the second VM.
- ArgoCD installed and configured on Minikube.
- GitHub account to fork and store the repository.
- Docker Hub account for storing the Docker image.
- Go to the Node.js GitHub repository: https://github.com/nodejs/nodejs.org.git
- Click on the "Fork" button in the upper-right corner to create a copy of the repository in your GitHub account.
On the VM where Jenkins is installed, clone the forked repository:
git clone git@github.com:<Ghobashy-Cloud>/nodejs.org.git- Ensure your VM has Node.js installed (version 18 is required). If not, install it:
sudo apt update sudo apt install -y nodejs npm nvm install 18
- Navigate to the project directory:
cd nodejs.org - Install the dependencies:
npm install
- Run the unit tests to ensure the application is working:
npm test
- Create a
Dockerfilein the root of your project directory. Here's an example Dockerfile:FROM node:18-alpine WORKDIR /app COPY package*.json ./ RUN npm install COPY . . EXPOSE 3000 CMD ["npm", "start"]
- Commit the
Dockerfileto your repository:git add Dockerfile git commit -m "Add Dockerfile" git push origin main
You will now configure Jenkins to automate the build and deployment process. The pipeline will:
- Fetch the code from the GitHub repository.
- Install dependencies.
- Run unit tests.
- Dockerize the application.
- Push the Docker image to Docker Hub.
Here is a basic structure of the Jenkins pipeline (Jenkinsfile):
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'git@github.com:<Ghobashy-Cloud>/nodejs.org.git'
}
}
stage('Install Dependencies') {
steps {
sh 'npm install'
}
}
stage('Run Unit Tests') {
steps {
sh 'npm test'
}
}
stage('Dockerize') {
steps {
script {
docker.build('khaled55/nodejs-app')
}
}
}
stage('Push Docker Image') {
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
docker.image('khaled55/nodejs-app').push('latest')
}
}
}
}
}
}-
Install Minikube on the second VM:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Start Minikube:
minikube start
-
Install kubectl:
sudo apt-get update sudo apt-get install -y apt-transport-https sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" sudo apt-get install -y kubectl
-
Install ArgoCD:
- Install ArgoCD on Minikube following ArgoCD official instructions.
-
Create a Kubernetes Deployment YAML file (
deployment.yaml):apiVersion: apps/v1 kind: Deployment metadata: name: nodejs-app spec: replicas: 2 selector: matchLabels: app: nodejs-app template: metadata: labels: app: nodejs-app spec: containers: - name: nodejs-app image: khaled55/nodejs-app:latest ports: - containerPort: 3000 --- apiVersion: v1 kind: Service metadata: name: nodejs-app-service spec: type: NodePort selector: app: nodejs-app ports: - protocol: TCP port: 80 targetPort: 3000 nodePort: 30080
-
Apply the Kubernetes configuration to deploy the app:
kubectl apply -f deployment.yaml
-
Monitor the deployment to ensure it’s running:
kubectl get pods
-
Access the Node.js application:
screenshots
Argocd coustmize
Fetch

This project demonstrates a full CI/CD pipeline for a Node.js application using Jenkins, Docker, Minikube, and ArgoCD. It automates the build, test, and deployment processes, allowing seamless integration and continuous delivery of the application.






