Load Balancing With Ingress
Index
Requirements
If you have already `microservices` namespace from the previous lab, please remove it and run the commands below for fresh start IN THE ROOT FOLDER.
kubectl delete ns microservices
bash ./yaml/preload-docker-image.sh
Deploy Nginx Ingress
https://kubernetes.github.io/ingress-nginx/deploy/
Deploying Ingress Rules
- Define the rules with the given yaml files below;
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-service
namespace: microservices
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- pathType: Prefix
path: "/orders"
backend:
service:
name: order-service
port:
number: 8080
- pathType: Prefix
path: "/customers"
backend:
service:
name: customer-service
port:
number: 8080
- pathType: Prefix
path: "/products"
backend:
service:
name: product-service
port:
number: 8080
command
kubectl apply -f ./ingress.yaml
- After deploying ingress definition you can send request with your favorite client as below;