arun9theja / RollingUpdate-Rollback-NodejsApp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blue Green Deployment NodejsApp

image

Pre-requisites:

- Install GIT
- EKS Cluster
- Install ALB-Ingress-Controller
- Request a Cerficate using Certificate Manager
- Create Hosted Zone with our Domain Name
- External DNS Setup

EKS Cluster Setup:

EKS Cluster Setup

ALB Ingress Controller Setup:

ALB Ingress Controller

Create Hosted Zone with our Domain Name

image image image

Request a Cerficate using Certificate Manager

In AWS certificate Manager:

image image image image Create Route53: image image

REfresh and check hostedzone: image

image

Note : ARN for certificate : arn:aws:acm:us-east-1:136962450893:certificate/c4e6bf26-02df-4e49-b88b-9412562c1966

External DNS Setup:

External DNS

image

Install GIT:

yum install git -y

Install npm:

sudo yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_13.x | sudo -E bash -
sudo yum install -y nodejs

Install Docker:

yum install docker -y
service docker start

Clone code from github:

git clone https://github.com/Naresh240/RollingUpdate-Rollback-NodejsApp
cd RollingUpdate-Rollback-NodejsApp

Build Maven Artifact:

npm install

Build Docker image for Springboot Application

docker build -t naresh240/nodejs-k8s:v1 .

Docker login

docker login

Push docker image to dockerhub

docker push naresh240/nodejs-k8s:v1

Deploy nodejs Application using below commands:

kubectl apply -f deployment.yml

image

kubectl apply -f service.yml

image

Check pods and services:

kubectl get pods
kubectl get svc

image

Run ingress for checking output with DNS name

kubectl apply -f ingress.yml

without externaldns and security:

Check Load Balancer of ALB ingress controller attached to ingress or not

kubectl get ingress

image

#remove paths for ssl and execute it again (kubectl apply -f ingress.yml and kubectl get ingress)

image

Now another load balance is created image image

Go to UI and check our external dns, which showing output application with HTTPS

http://nodejs.staticwebsitehosting.tk/

image

Upgrading for nodejs Application:

Edit our our application and Build docker image with new tag:

docker build -t naresh240/nodejs-k8s:v2 .

Push Docker image to docker hub with tag v2:

docker push naresh240/nodejs-k8s:v2

upgrade nodejs application with tag v2:

kubectl rollout history deployment nodejs-deployment

Check rollout history for revision "1"

kubectl rollout history deployment nodejs-deployment --revision=1

Upgrade new image using below command

kubectl set image deployment nodejs-deployment nodejs-deployment=naresh240/nodejs-k8s:v2

Goto Web UI and check updated version output

image

Check rollout history for revision "2"

kubectl rollout history deployment nodejs-deployment --revision=2

Rollout to previous version using below command

kubectl rollout undo deployment nodejs-deployment --to-revision=1

Goto Web UI and check again:

https://nodejs.cloudtechmasters.ml/

image

After updating the domain in ingress.yml, run the ingress.yml

image

About


Languages

Language:Dockerfile 58.3%Language:JavaScript 41.7%