Tuesday, December 31, 2024

Gloo Gateway on Kind

Summary

In this post, I'll cover a demo deployment of Gloo Gateway in a Kind K8s environment.
  • 3-worker node Kind K8s environment
  • 2 dummy REST microservices implemented in Nodejs via Express.js
  • OSS deployment of Gloo Gateway providing ingress to the two microservices

Architecture

Deployment

Kind



echo -e "\n*** Deploy Cloud Provider Kind ***"
docker run -d --rm --name cloud-provider-kind --network kind \
-v /var/run/docker.sock:/var/run/docker.sock registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.4.0
echo -e "\n*** Deploy Kind Cluster ***"
kind create cluster --config=$PWD/kind/config.yaml --name demo-kind-cluster
if [ -z "$(docker image ls -q ms1:1.0)" ]
then
echo -e "\n*** Build Microservice 1 Container ***"
docker build --no-cache --tag ms1:1.0 $PWD/ms1
fi
if [ -z "$(docker image ls -q ms2:1.0)" ]
then
echo -e "\n*** Build Microservice 2 Container ***"
docker build --no-cache --tag ms2:1.0 $PWD/ms2
fi
echo -e "\n*** Load Microservice Images ***"
kind --name demo-kind-cluster load docker-image ms1:1.0
kind --name demo-kind-cluster load docker-image ms2:1.0
view raw kind.sh hosted with ❤ by GitHub

Gloo Gateway



echo -e "\n*** Deploy Gloo Gateway ***"
./glooctl install gateway
echo -e "\n*** Create Routes to Microservices ***"
./glooctl add route --name vs1 --path-exact /ms1 --dest-name default-ms1-service-8000 --prefix-rewrite /service1
./glooctl add route --name vs1 --path-exact /ms2 --dest-name default-ms2-service-9000 --prefix-rewrite /service2
view raw gloo.sh hosted with ❤ by GitHub

Microservices



echo -e "\n*** Deploy Microservices ***"
kubectl apply -f $PWD/ms1/ms1.yaml
kubectl apply -f $PWD/ms2/ms2.yaml
kubectl rollout status deployment/ms1-app
kubectl rollout status deployment/ms2-app
view raw micro.sh hosted with ❤ by GitHub

Source