Coder Social home page Coder Social logo

pro's Introduction

Basic Multi container Application in Kubernetes

In this demo project we are using React client, Node.js backend, PostgreSQL and Nginx for application and Deployment using Kubernetes.

It is a basic application to get inputs as numbers from client and retrieve saved numbers from Database.

#Lets get started with deployment.

Pre-Requisites

  1. Install minikube
  2. Install kubectl
  3. Install Docker

Build Container image for application.

In this demo we are using 3 containers

  • [db] (Postgres) - Database

  • client - Client App

  • server - Server App

Creating and push images to Dockerhub.

git clone https://github.com/boobalana/pro.git pro
cd pro/apps

Build Image for Client

cd client
docker build -t <imagename:version> .
docker push <imagename:version> <repo/imagename:version>

Build Image for Server

cd ../server
docker build -t <imagename:version> .
docker push <imagename:version> <repo/imagename:version>

i will be using following images which are created using above steps.

Kubernetes Manifest

All Kubernetes Manifest files are under kubernetes folder.

client-cluster-ip-service.yml
database-persistent-volume-claim.yml
postgres-cluster-ip-service.yml
server-cluster-ip-service.yml
client-deployment.yml
db-secret.yaml
postgres-deployment.yml
server-deployment.yml

Creating multiple Environment.

Here we are going to use kustomize to deploy Application in 2 Environment (Dev and Prod).

Under infra folder we have kustomize templates to deploy Application in multiple Environments.

Base folder holds all the kubernetes manifest and kustomize file overlays will be used to have custom configuration based on Environment. Example here are running 1 replica for dev and 2 replica for Prod

Each Environments can deployed in its own namespace (dev/prod). Here we are using 2 namespace i.e Dev & Prod

cd infra
kubectl create -k overlays/dev
kubectl  get all --namespace=dev
kubectl create -k overlays/prod
kubectl  get all --namespace=prod

Accessing Application

Ensure all resources are in running state.

kubectl  get all --namespace=dev
kubectl  get all --namespace=prod

Accessing with URL.

minikube svc <Client SVC> --url -n <namespace>

Access with the above URL in Browser.

Cleanup of resources.

kubectl delete -k overlays/dev
kubectl delete -k overlays/prod

pro's People

Contributors

boobalana 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.