Git Product home page Git Product logo

hpa-nodejsapp's Introduction

HPA NodejsApp

Pre-requisites:

- Install GIT
- EKS Cluster

EKS Cluster Setup:

EKS Cluster Setup

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/HPA-NodejsApp
cd HPA-NodejsApp

Build Maven Artifact:

npm install

Build Docker image for Springboot Application

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

Docker login

docker login

Push docker image to dockerhub

docker push naresh240/nodejs-hpa-k8s:v1:v1

Deploy nodejs Application using below commands:

kubectl apply -f deployment.yml
kubectl apply -f service.yml

Check all inside kubernetes:

kubectl get all

image

If you want see horizontal pod autoscaling we need metrics

kubectl apply -f metrics-server

Run HPA for our Nodejs application

kubectl apply -f hpa.yml

Check all inside kubernetes:

kubectl get all  

image

Connect to pod and increase CPU Utilization using below commands

kubectl get pods
kubectl exec -it nodejs-deployment-76c9dffdb9-4m68x -- /bin/bash
for i in 1 2 3 4; do while : ; do : ; done & done

Now see pods will increase slowly

kubectl get all

image

Again connect to pod and kill for loop for reducing CPU Utilization using below command

for i in 1 2 3 4; do kill %$i; done

It will reduce pods again, because CPU utilization reduces

hpa-nodejsapp's People

Contributors

naresh240 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.