Skip to content

amrityam/kubernetes-hands-on

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kubernetes-hands-on

Prerequisites:

As an alternative if you are using Windows/Mac system, you can install docker desktop which provides native kubernetes support.

References:

Install K8 through Docker desktop for Windows: https://birthday.play-with-docker.com/kubernetes-docker-desktop/

Install K8 through Docker desktop for Mac: https://medium.com/backbase/kubernetes-in-local-the-easy-way-f8ef2b98be68

demo-voting-app Microservice Architecture

arc_diagram!

demo-voting-app with Pods and Services

K8_diagram!

demo-voting-app Deployment with Scale up Architecture

K8_deployment_diagram!

  • A front-end web app in Python which lets you vote between two options
  • A Redis queue which collects new votes
  • A .NET Core worker which consumes votes and stores them in Postgres database
  • A Postgres DB which store the vote count from worker
  • A Node.js webapp which shows the results of the voting in real time

Run the appplication in Kubernetes


Clone this repo: git clone https://github.com/amrityam/kubernetes-hands-on.git

First create the demo-voting-app namespace:

kubectl create namespace demo-voting-app

Run the following command to create the deployments and services objects:

cd kubernetes-hands-on\demo-voting-app\k8-specifications

kubectl create -f deployments\voting-app-deployment.yaml
kubectl create -f services\voting-app-service.yaml

kubectl create -f deployments\redis-deployment.yaml
kubectl create -f services\redis-service.yaml

kubectl create -f deployments\postgres-deployment.yaml
kubectl create -f services\postgres-service.yaml

kubectl create -f deployments\worker-app-deployment.yaml

kubectl create -f deployments\result-app-deployment.yaml
kubectl create -f services\result-app-service.yaml


Now validate all the deployments and pods are running fine by using below command.

kubectl get deployments,pods,svc --namespace demo-voting-app

validate_pods_deployments!

The voting-app is now available on port 30004 and the result-app one is running on port 30005.

voting-app!

result-app!

Scale up the deployments:

kubectl scale deployments voting-app-deploy --replicas=3 --namespace demo-voting-app

scale-up!

Now refresh the voting-app page and you can notice each time the page is served by a new pod.

scale-up-pod1! scale-up-pod2!

Clean up resources and delete namespace:

To stop the application and delete all resources run the below command which deletes the namespace we have created earlier.

kubectl delete namespace demo-voting-app

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published