Skip to content

Create a CI/CD pipeline for the MERN App in Kubernetes (k3s) on AWS EC2 using GitHub Actions with zero or minimum downtime. After pushing the code in the “main” branch run a workflow to build & push the image in Docker Hub & another workflow deploy it in Kubernetes (k3s) on AWS EC2.

Notifications You must be signed in to change notification settings

bjnandi/ci-cd-pipeline-MERN-k3s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CI/CD Pipeline for MERN App in Kubernetes (k3s) with GitHub Actions

Step 1: Clone the repository in the local machine

git clone https://github.com/bjnandi/ci-cd-pipeline-MERN-k3s.git

Step 2: Now, We need to fill in the secrets using GitHub Secrets that you can add to our GitHub repo. You can read GitHub Secrets for more details. Now we go to secrets and variables and set values.

Github > Repo Name > Settings > Secrets and variables > Action > Repository Secrets > New repository secret

EC2_HOST: The public IP address of the bastion host EC2 instance, will look something like this “34.195.33.137”.
MASTER_NODE: The private IP address of the k8s-instance-master EC2 instance, will look something like this “10.0.1.222”.
EC2_USERNAME: The username of the EC2 instance, usually “ubuntu”.
SSH_PRIVATE_KEY: This will be our “.pem” file which will be used to login to the instance.
DOCKER_USERNAME: This will be the “username” of our docker hub you can see it when you go to the docker hub account profile. It will used to push the docker images on the docker hub.
DOCKER_PASSWORD: This is the “password” of your docker hub account.

Step 3: Return to the “VS Code Editor” & edit or minor changes in the code or a UI file for the demo test then commit & push the code in the GitHub “main” branch for CI/CD testing in our app for now in the file:

client > src > components > Navbar.js file

Search “CRUD” text and replace it with “CRUD test” then commit and push it on the main branch.

It takes some time to build, push, and deploy. Sometime later we saw our changes show in our app UI (http://bjtechlife.com) which works properly like inserting data

Learn More Here

Build an End-to-End CI/CD Pipeline for a MERN App in Kubernetes with Terraform using GitHub Actions & Ansible

Happy coding! 💻✨

About

Create a CI/CD pipeline for the MERN App in Kubernetes (k3s) on AWS EC2 using GitHub Actions with zero or minimum downtime. After pushing the code in the “main” branch run a workflow to build & push the image in Docker Hub & another workflow deploy it in Kubernetes (k3s) on AWS EC2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published