Home Web Front-end JS Tutorial Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Jan 02, 2025 pm 07:39 PM

This guide provides step-by-step instructions for deploying a full-stack chat application on Kubernetes using Kind, Metallb, and Ingress. It is designed to help developers set up a robust Kubernetes cluster for hosting containerized applications on a virtual private server (VPS).

The deployment includes setting up essential Kubernetes tools, configuring a load balancer, integrating SSL for secure communication, and deploying both the frontend and backend services. Additionally, optional sections cover monitoring the application with Prometheus and Grafana for enhanced observability and performance tracking.

Whether you are deploying a chat application for production or exploring Kubernetes capabilities, this guide will serve as a comprehensive roadmap to get your application up and running efficiently.

? Getting Started For k8s

Below table helps you to navigate to the particular tool installation section fast.

Tech stack Installation
Docker Install and configure Docker
Kind & Kubectl Install and configure Kind & Kubectl
Metallb Install Metallb
Ingress Install and configure Ingress
Helm Helm Install and configure
SSL Certificate Install and configure Cert Manager
Project Deploy Project Deploy and Others
Monitoring Namespace Create for Groping Prometheus and grafana and Other
Prometheus Install and configure Prometheus
Grafana Install and configure Grafana

? Pre-requisites to implement this project:

[!Note]
vps minimum need

  • RAM - 4GB
  • CPU - 2 Core(s)
  • Storage - 20 GB
  • One Domain

? Docker Install and configure

sudo apt-get update

sudo apt-get install docker.io -y
sudo usermod -aG docker $USER && newgrp docker

Copy after login
Copy after login
Copy after login

? Kind & Kubectl Install and configure

Install KIND and kubectl using the provided script. Create kind_kubectl_config.yaml file:

#!/bin/bash

# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
chmod +x ./kind
sudo cp ./kind /usr/local/bin/kind

VERSION="v1.31.0"
URL="https://dl.k8s.io/release/${VERSION}/bin/linux/amd64/kubectl"
INSTALL_DIR="/usr/local/bin"

curl -LO "$URL"
chmod +x kubectl
sudo mv kubectl $INSTALL_DIR/
kubectl version --client

rm -f kubectl
rm -rf kind

echo "kind & kubectl installation complete."
Copy after login
Copy after login
Copy after login
./kind_kubectl_config.yaml
Copy after login
Copy after login
Copy after login

[!Note]
If your Vps ARM64 then use this [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
Run this script and it cerate kubectl and kind environment.
Kind Install More Information

?️ Setting Up the KIND Cluster

Create a kind-cluster-config.yaml file:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

nodes:
- role: control-plane
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
Copy after login
Copy after login
Copy after login

Create the cluster using the configuration file:

kind create cluster --config kind-cluster-config.yaml --name my-kind-cluster
Copy after login
Copy after login
Copy after login

Verify the cluster:

kubectl get nodes
kubectl cluster-info
Copy after login
Copy after login
Copy after login

[!Note]
Here i add extraPortMappings for running Ingress

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

? Metallb Install

[!Note]
I am using Metallb for use LoadBalance. Suppose you are using Aws/Azure/DigitalOcean ect whose provide kubernates loadBalance facility then doesn't need Metallb. Here I buy VPS from a local company. They give one IP address to access VPS.

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-frr.yaml

Copy after login
Copy after login
Copy after login

Check Metallb configuration

kubectl get all -n metallb-system
Copy after login
Copy after login

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

?️ Create a metallb_config.yaml file:

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: first-pool
  namespace: metallb-system
spec:
  addresses:
  - 160.191.163.33-160.191.163.33
Copy after login
Copy after login

apply metallb_config.yaml file

kubectl apply -f metallb_config.yaml
Copy after login
Copy after login

[!Note]
MY VPS IP address is 160.191.163.33. Change this IP as your require

♻️ Ingress Install and configure

kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml
Copy after login

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

[!Note]
Here service/ingress-nginx-controller show EXTERNAL-IP is your VPS IP. My VPS IP is 160.191.163.33. It ensure that Our Metallb LoadBalance wroking.

? Helm Install and configure

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh

./get_helm.sh
Copy after login

Check Helm Version

helm version
Copy after login

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

?? Install and configure Cert Manager || SSL Certificate

sudo apt-get update

sudo apt-get install docker.io -y
sudo usermod -aG docker $USER && newgrp docker

Copy after login
Copy after login
Copy after login

Installing cert-manager CRDs

#!/bin/bash

# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
chmod +x ./kind
sudo cp ./kind /usr/local/bin/kind

VERSION="v1.31.0"
URL="https://dl.k8s.io/release/${VERSION}/bin/linux/amd64/kubectl"
INSTALL_DIR="/usr/local/bin"

curl -LO "$URL"
chmod +x kubectl
sudo mv kubectl $INSTALL_DIR/
kubectl version --client

rm -f kubectl
rm -rf kind

echo "kind & kubectl installation complete."
Copy after login
Copy after login
Copy after login

https://artifacthub.io/packages/helm/cert-manager/cert-manager

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

? Project Deploy and Others

Step One

Clone the below Project in your VPS

./kind_kubectl_config.yaml
Copy after login
Copy after login
Copy after login

Step Two

Go to k8s folder and you can see this file

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Step Three

Create Nampe Space

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

nodes:
- role: control-plane
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
Copy after login
Copy after login
Copy after login

Step Four

Apply all Secret file

kind create cluster --config kind-cluster-config.yaml --name my-kind-cluster
Copy after login
Copy after login
Copy after login

Step Five

Declear Mongodb Volumes and Others

kubectl get nodes
kubectl cluster-info
Copy after login
Copy after login
Copy after login

Step Six

Apply the Rest of Other file

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-frr.yaml

Copy after login
Copy after login
Copy after login

Step Seven

Configure SSL Certificate Domain. Open ssl_certificate.yaml and edit your desired domain name

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Apply ssl_certificate.yaml file

kubectl get all -n metallb-system
Copy after login
Copy after login

Step Eight

Configure Ingress file. Open ingress.yaml and add your desired domain name.

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Apply ingress.yaml file

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: first-pool
  namespace: metallb-system
spec:
  addresses:
  - 160.191.163.33-160.191.163.33
Copy after login
Copy after login

Check Certificate

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Check NameSpace

kubectl apply -f metallb_config.yaml
Copy after login
Copy after login

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

? Browser View

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

? Conclusion

Congratulations! You’ve successfully deployed the Full-Stack Chat Application . You can now access your Chat App.

? Monitoring and Others [Optional]

Now we are doing Extra features like Monitoring. It helps you learn about servers and apps.

Create Namespace

sudo apt-get update

sudo apt-get install docker.io -y
sudo usermod -aG docker $USER && newgrp docker

Copy after login
Copy after login
Copy after login

Check Namespace

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

[!Note]
This Namespace helping to control all monitoring app like- Prometheus, Grafana, Loki ect

Prometheus and Grafana Install and Configure

Install

#!/bin/bash

# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
chmod +x ./kind
sudo cp ./kind /usr/local/bin/kind

VERSION="v1.31.0"
URL="https://dl.k8s.io/release/${VERSION}/bin/linux/amd64/kubectl"
INSTALL_DIR="/usr/local/bin"

curl -LO "$URL"
chmod +x kubectl
sudo mv kubectl $INSTALL_DIR/
kubectl version --client

rm -f kubectl
rm -rf kind

echo "kind & kubectl installation complete."
Copy after login
Copy after login
Copy after login

Run Prometheus Via Port

./kind_kubectl_config.yaml
Copy after login
Copy after login
Copy after login

now you can access Prometheus using this port. Like

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

nodes:
- role: control-plane
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
Copy after login
Copy after login
Copy after login

[!Note]
Change IP Address

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Grafana Install and Configure
Run Grafana Via Port

kind create cluster --config kind-cluster-config.yaml --name my-kind-cluster
Copy after login
Copy after login
Copy after login

Get Grafana Username and Password

UserName

kubectl get nodes
kubectl cluster-info
Copy after login
Copy after login
Copy after login

password

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-frr.yaml

Copy after login
Copy after login
Copy after login

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

[!Note]
You can change password

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

Grafana Dashboard.

Here you can choose different type Algorithm Dashboard

Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress

That’s all. Happy Learning :) .
[if it is helpful, giving a star to the repository ?]

Project Github Link
https://github.com/kamruzzamanripon/k8-node-react-mongodb-app

The above is the detailed content of Chat App Deploy on Kubernetes Using Kind, Metallb and Ingress. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I create and publish my own JavaScript libraries? How do I create and publish my own JavaScript libraries? Mar 18, 2025 pm 03:12 PM

Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

How do I optimize JavaScript code for performance in the browser? How do I optimize JavaScript code for performance in the browser? Mar 18, 2025 pm 03:14 PM

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

What should I do if I encounter garbled code printing for front-end thermal paper receipts? What should I do if I encounter garbled code printing for front-end thermal paper receipts? Apr 04, 2025 pm 02:42 PM

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

How do I debug JavaScript code effectively using browser developer tools? How do I debug JavaScript code effectively using browser developer tools? Mar 18, 2025 pm 03:16 PM

The article discusses effective JavaScript debugging using browser developer tools, focusing on setting breakpoints, using the console, and analyzing performance.

How do I use source maps to debug minified JavaScript code? How do I use source maps to debug minified JavaScript code? Mar 18, 2025 pm 03:17 PM

The article explains how to use source maps to debug minified JavaScript by mapping it back to the original code. It discusses enabling source maps, setting breakpoints, and using tools like Chrome DevTools and Webpack.

How do I use Java's collections framework effectively? How do I use Java's collections framework effectively? Mar 13, 2025 pm 12:28 PM

This article explores effective use of Java's Collections Framework. It emphasizes choosing appropriate collections (List, Set, Map, Queue) based on data structure, performance needs, and thread safety. Optimizing collection usage through efficient

TypeScript for Beginners, Part 2: Basic Data Types TypeScript for Beginners, Part 2: Basic Data Types Mar 19, 2025 am 09:10 AM

Once you have mastered the entry-level TypeScript tutorial, you should be able to write your own code in an IDE that supports TypeScript and compile it into JavaScript. This tutorial will dive into various data types in TypeScript. JavaScript has seven data types: Null, Undefined, Boolean, Number, String, Symbol (introduced by ES6) and Object. TypeScript defines more types on this basis, and this tutorial will cover all of them in detail. Null data type Like JavaScript, null in TypeScript

Getting Started With Chart.js: Pie, Doughnut, and Bubble Charts Getting Started With Chart.js: Pie, Doughnut, and Bubble Charts Mar 15, 2025 am 09:19 AM

This tutorial will explain how to create pie, ring, and bubble charts using Chart.js. Previously, we have learned four chart types of Chart.js: line chart and bar chart (tutorial 2), as well as radar chart and polar region chart (tutorial 3). Create pie and ring charts Pie charts and ring charts are ideal for showing the proportions of a whole that is divided into different parts. For example, a pie chart can be used to show the percentage of male lions, female lions and young lions in a safari, or the percentage of votes that different candidates receive in the election. Pie charts are only suitable for comparing single parameters or datasets. It should be noted that the pie chart cannot draw entities with zero value because the angle of the fan in the pie chart depends on the numerical size of the data point. This means any entity with zero proportion

See all articles