Deploy a Web Application Using Kubernetes Locally

Introduction

In previous article, we talk about how to deploy our application using docker compose with AWS ElasticBeanstalk. That is great but still has some problems. Imagine that you just want to add server container without affecting others, it is a little bit hard to do if we use previous approach. Thus, we can use kubernetes to fix it. My previous article also talks about the basis of Kubernetes, please check it out.

This is a simple calculator to calculate Fibonacci Sequence. If you do not know or forgot about Fib, please visit here.

Solution Diagram

When traffic is coming, ingress will help us classify the traffic to client and server end. We use ClusterIP to expose a set of pods to other objects in the cluster.

Install Kubernetes

Go to Kubernetes and install it according to your OS.

After installation, we are able to see the version of Kubernetes using below command:

kubectl version --client

Install Minikube

Go to Minikube and install it according to the guidelines with your own OS.

After installation, we are able to check and start Minikube by below command:

minikube start

Deploy an Application

Go to Github and download my prepared configuration. Or you may:

git clone https://github.com/manbobo2002/node-react-calculator-k8s.git

Then go to the project root directory then deploy it.

cd node-react-calculator-k8s
kubectl apply -f k8s
minikube ip

You may see a warning about Ingress, that is okay. Then we browse the ip that minikube provided.

Then we are able to see our application.

However, this way is suitable for local only. If we want to go for production, we are recommended to use AWS/GCP/Azure those cloud provider service.

Leave a Reply