This project demonstrates a containerized Angular application deployed on Kubernetes with Horizontal Pod Autoscaling (HPA). It includes tools to simulate user load and visualize scaling behavior.
- daily-quotes/: Source code for the Angular frontend and Node.js backend.
- k8s/: Kubernetes manifest files (
deployment.yaml). - deploy.sh: Script to build the Docker image and deploy to a local Kubernetes cluster (Kind or Minikube).
- deploy_dyn.sh: Variant of the deployment script for dynamic scaling scenarios.
- simulate_users.py: Python script to generate concurrent HTTP traffic for load testing.
- set_load.sh: Helper script to manually set active user metrics (if supported by the backend/deployment).
- kubernetes_features.md: Detailed explanation of the Kubernetes features used (Deployment, Service, HPA).
- Docker: For building container images.
- Kubernetes Cluster: A local cluster like Kind or Minikube.
- kubectl: Command-line tool for interacting with the cluster.
- Python 3: For running the load simulation script.
- Start your local cluster (if not already running).
- Run the deployment script:
This script will:
./deploy.sh
- Build the
daily-quotes:latestDocker image. - Load the image into your local cluster (Kind/Minikube).
- Apply the Kubernetes configuration from
k8s/deployment.yaml.
- Build the
Once deployed, check the service status:
kubectl get svc daily-quotes-serviceAccess the application via the provided External-IP or localhost (depending on your environment/tunneling).
Use the included Python script to generate traffic and trigger autoscaling:
# SImulate 50 concurrent users for 60 seconds
python3 simulate_users.py -n 50 -d 60If using deploy_dyn.sh, you can use set_load.sh to adjust specific load metrics:
./set_load.sh 100Watch the HPA status to see the replica count change in response to load:
kubectl get hpa daily-quotes-scaling -w