This project is a Kubernetes-based microservice application consisting of three main components:
-
Frontend: A React Vite application for the user interface.
-
Backend 1: A Flask API for processing timezone-based requests with a health check endpoint.
-
Backend 2: An Express Node.js API for additional timezone-based processing with a health check endpoint.
The microservices are orchestrated using Kubernetes with Ingress routing for easy access.
- Docker Desktop (with Kubernetes enabled)
- kubectl
- Helm
- minikube
-
Clone the repository:
git clone https://github.com/bosukeme/k8s-microservices-architecture.git cd k8s-microservices-architecture -
Deploy the Flask API
cd k8s/api-flask kubectl apply -f flask.deployment.yaml kubectl apply -f flask.service.yaml kubectl apply -f flask.ingress.yamlVerify if the resources were created successfully:
kubectl get po,deploy,svc,ingress -l app=api-flask
-
Setup Minikube Tunnel:
Open a new terminal and run:minikube tunnel --bind-address 0.0.0.0 -
Set up
/etc/hosts:``` # Linux / MacOs minikube ip # Windows (WSL) hostname -I ``` Edit `/etc/hosts` (Linux/MacOS) or `c\windows\system32\drivers\etc\hosts` (Windows). <br/> Add `<ipaddress from the above step> api-flask.io` <br/> * Example ``` 172.29.204.16 api-flask.io ``` <br/>
-
Verify Flask API Setup
Visithttp://api-flask.ioin your browser

-
Possible troubleshooting:
If you are unable to access the endpoint:
- Restart Minikube Tunnel:
sudo pkill -f "minikube tunnel" minikube tunnel --bind-address 0.0.0.0- Ensure the Ingress Controller IP type is
LoadBalancer:
kubectl patch svc ingress-nginx-controller -n ingress-nginx -p '{"spec": {"type": "LoadBalancer"}}'- Enable Ingress:
minikube addons enable ingress- Use localhost instead. This will return a list of localhost url for a particular service
minikube service list -
Deploy the Node API
Open a new terminal:cd k8s/api-node kubectl apply -f node.deployment.yaml kubectl apply -f node.service.yaml kubectl apply -f node.ingress.yamlVerify:
kubectl get po,deploy,svc,ingress -l app=api-nodeUpdate
/etc/hostswith: Add<ipaddress from the above step> api-node.io- Example
172.29.204.16 api-node.io
Visit
http://api-node.ioon the browser -
Deploy the React Client
Open a new terminal:
cd k8s/client-react kubectl apply -f react.deployment.yaml kubectl apply -f react.service.yaml kubectl apply -f react.ingress.yamlVerify
kubectl get po,deploy,svc,ingress -l app=client-reactUpdate
/etc/hostswith: Add<ipaddress from the above step> client-react.io- Example
172.29.204.16 client-react.io
Visit
http://client-react.ioon the browser
- kubectl delete -f k8s/api-flask/
- kubectl delete -f k8s/api-node/
- kubectl delete -f k8s/client-react/
If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request.
Ukeme Wilson

