Code Monkey home page Code Monkey logo

nodejs-server-kubernetes's Introduction

Kubernetes Demo

This is project was used to learn about Kubernetes. The API REST it self is not the focus, but the Kubernetes and its configuration.

Kubernetes is a tool for automating the deployment and management of containerized applications. With the self-healing nature of Kubernetes, it is possible to deploy and manage applications without any human intervention.

The focus of this project is to run multiple instances of the API REST in a Kubernetes cluster that communicates with a PostgreSQL database

The following tools are needed to run this project:

The following tools are used:

In the project is using an API Rest with the image matheusinit/nodejs-k8s, in version 0.1. There are two routes:

  • / - to get a hello world from Kubernetes Pod
  • /users - to insert a dumby user data and return it the list of users

Setup with Docker (development)

To run this application in your machine (development):

docker compose up -d 

(This is needed only once) - To apply database migrations:

docker-compose exec api-rest pnpm db:migrate

To check if application is running:

curl http://0.0.0.0:3000 | jq 

Setup with Kubernetes (production-like)

Start minikube to run Kubernetes on your machine:

minikube start

View documentation of Minikube to more information

To view Kubernetes metrics in Minikube:

minikube dashboard

To run load test in NodeJS API Rest cluster to increase the number the pods:

wrk -t4 -c300 -d60s http://{SERVICE_HOST}:{SERVICE_PORT}/users

Meaning:

  • {SERVICE_HOST} - API REST with NodeJS service host
  • {SERVICE_PORT} - API REST with NodeJS service port

To view service url with host and port use minikube service nodejs-api-rest --url

nodejs-server-kubernetes's People

Contributors

matheusinit avatar

Watchers

 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.