Skip to main content

Command Palette

Search for a command to run...

Deploying a Reddit Clone App on Kubernetes with Ingress

Published
โ€ข2 min read
Deploying a Reddit Clone App on Kubernetes with Ingress

In this guide, we will walk you through the deployment of a Reddit clone application on a Kubernetes cluster using Ingress. Kubernetes provides a scalable and reliable platform for running containerized applications.

Before you can set up Minikube to run Kubernetes on your local machine, you need to ensure that your system meets certain prerequisites. Here are the common prerequisites for installing Minikube:

*Minikube

*Kubectl

*System resources

Installing Minikube on AWS cloud

#Update System Packages
sudo apt update
#Install Required Packages
sudo apt install -y curl wget apt-transport-https
#Install Docker
sudo apt install -y docker.io
#start and enable docker
sudo systemctl enable --now docker
#Add current user to docker group (To use docker without root)
sudo usermod -aG docker $USER && newgrp docker
Now, logout (use exit command) and connect again.

Install Minikube

First, download the Minikube binary using curl:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Make it executable and move it into your path:

chmod +x minikube
sudo mv minikube /usr/local/bin/

Download kubectl, which is a Kubernetes command-line tool.

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

Make it executable and move it into your path:

chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Start Minikube

Clone remote repo using git clone

Navigate to the Project directory

Build the Docker image for the Reddit clone app: docker build -t reddit-clone-app .

Tagging image to push it to the docker repo

docker image tag image tag(reddit-clone-app):latest docker_username/ reddit-clone-app:latest

Pushing Image to the Docker repo

docker push docker_username/reddit-clone-app

Creating the Deployment Manifest file

Verify Deployments

Create a Service Manifest file

Apply the Service Manifest file

Accessing the application by the URL provided by the MiniKube

Expose the deployment and service using NodePort

Port forwarding

A custom port must be assigned on the ec2 instance security groups to access the deployment

In my case it 18.212.126.107:3000

Check the app deployment on ec2 instance public IP:portnumber

http://18.212.126.107:3000

Ingress is an API object that manages external access to services within a cluster. It's more like a gateway at the cluster verifying the requests and routing them according to the path-based or host-based pages.

Enabling ingress Inside the cluster

Applying Ingress Manifest & testing it with curl command

Congratulations on completing your Reddit clone app with Ingress for the Kubernetes project! During this project, we gained valuable insights into containerization, Kubernetes orchestration, Ingress configuration, and DevOps practices.