Skip to content

Repository files navigation

Daily Quotes - Kubernetes Autoscaling Demo

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.

Project Structure

  • 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).

Prerequisites

  • 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.

Deployment

  1. Start your local cluster (if not already running).
  2. Run the deployment script:
    ./deploy.sh
    This script will:
    • Build the daily-quotes:latest Docker image.
    • Load the image into your local cluster (Kind/Minikube).
    • Apply the Kubernetes configuration from k8s/deployment.yaml.

Usage

Accessing the Application

Once deployed, check the service status:

kubectl get svc daily-quotes-service

Access the application via the provided External-IP or localhost (depending on your environment/tunneling).

Simulating Load

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 60

Controlling Load (Dynamic Mode)

If using deploy_dyn.sh, you can use set_load.sh to adjust specific load metrics:

./set_load.sh 100

Monitoring Autoscaling

Watch the HPA status to see the replica count change in response to load:

kubectl get hpa daily-quotes-scaling -w

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages