A Kubernetes demo project showcasing how to deploy a containerized Golang web application on Minikube with Ingress routing and Horizontal Pod Autoscaling (HPA) based on CPU utilization. Includes a CPU-intensive endpoint for load testing and observing real-time scaling.
- Deploy a lightweight Go web application in Kubernetes.
- Configure Ingress for external access.
- Implement Horizontal Pod Autoscaler (HPA) based on CPU metrics.
- Enable Metrics Server for scaling metrics.
- Perform load testing with
heyorabto trigger scaling events. - Observe pods automatically scale up/down in response to workload.
- Golang 1.22
- Docker
- Kubernetes (Minikube)
- Ingress Controller
- Metrics Server
- Horizontal Pod Autoscaler
- Load Testing Tools (
hey,ab)
scalable-minikube-app/
├─ app/ # Go application source code
├─ k8s/ # Kubernetes manifests
├─ scripts/ # Build & load test scripts
├─ Dockerfile # Container build config
├─ .dockerignore
├─ .gitignore
└─ README.md
minikube start --memory=4096 --cpus=2minikube addons enable metrics-server
minikube addons enable ingresseval $(minikube docker-env)
docker build -t scalable-minikube-app:local .kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml
kubectl apply -f k8s/hpa.yamlGet Minikube IP:
minikube ipEdit /etc/hosts (Linux/Mac) or C:\Windows\System32\drivers\etc\hosts (Windows) and add:
<MINIKUBE_IP> scalable-minikube.localOpen in browser:
http://scalable-minikube.local/hey -z 60s -c 50 http://scalable-minikube.local/cpu?ms=500kubectl get hpa -w
kubectl get pods -wYou’ll see pods scale from 1 → N and back down when the load stops.
kubectl delete -f k8s/
minikube stop