Deploy a Reddit Clone with Kubernetes Ingress ProjectšŸ˜

Ā·

2 min read

Project Architecture :

pre-requests for this project :

clone the code from GitHub

build the docker image

push the image in the docker hub

deploy the code in Kubernetes

Step 1 :

Create Two Servers:

t2.micro - CI SERVER

t2.medium- Deployment Server

Step: 2

Clone the Code

step : 3

Install Docker in your CI Server

sudo apt-get update

sudo apt-get install docker.io -y

sudo usermod -aG docker $USER && newgrp docker

git clone https://github.com/LondheShubham153/reddit-clone-k8s-ingress.git

Step: 4

Build the Docker Image

docker build . -t safiakhatoon/reddit-clone

docker images

Push the image into DockerHub

docker login

docker push safiakhatoon/reddit-clone:latest

In DockerHub

Step: 5(Deployment Server)

Install Docker

sudo apt-get update

sudo apt-get install docker.io -y

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube

sudo snap install kubectl --classic

minikube start --driver=docker

Step: 6

mkdir reddit project

vim deployment.yaml

kubectl apply -f deployment.yml

kubectl get deployment

vim service.yml

kubectl apply -f service.yml

minikube service reddit-clone-service --url

curl -L http://192.168.49.2:31000

Expose the app

kubectl expose deployment reddit-clone-deployment --type=NodePort

open 3000 port

kubectl port-forward svc/reddit-clone-service 3000:3000 --address 0.0.0.0 &

copy your public IP and port 3000

ex : http://23.22.154.54:3000/

*****************************Deployment is Done*****************************

step: 7 (INGRESS)

what is ingress?

In simple terms, Ingress is a Kubernetes object that allows external users to access services running inside a Kubernetes cluster. It acts as a gateway or entry point for incoming traffic to reach the services running inside the cluster.

why ingress is used?

Ingress is used to allow external users to access services running inside a Kubernetes cluster. It acts as a gateway or entry point for incoming traffic to reach the services running inside the cluster. It provides a way to route traffic to different services based on the URL path or domain name and also enables the use of SSL/TLS encryption for secure communication.

minikube addons enable ingress

vim ingress.yml

kubectl apply -f ingress.yml

curl -L domain.com/test

Thank you for reading this blog. Hope it helps.

ā€” Safia Khatoon

Happy Learning :)

Ā