{"id":27209693,"url":"https://github.com/githubsolver123/quiz-app-kubernetes","last_synced_at":"2026-01-23T10:16:36.534Z","repository":{"id":284874568,"uuid":"956339207","full_name":"GithubSolver123/quiz-app-kubernetes","owner":"GithubSolver123","description":"A Quiz Application deployed on Kubernetes demonstrating containerization, orchestration, auto-scaling, and persistent storage.","archived":false,"fork":false,"pushed_at":"2025-03-28T05:54:44.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T00:57:52.935Z","etag":null,"topics":["auto-scaling","ci-cd","cloud-native","containerization","deployment","devops","docker","flask","kubernetes","microservices","minikube","persistent-storage","quiz-app","web-application"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GithubSolver123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T04:54:45.000Z","updated_at":"2025-03-28T06:37:27.000Z","dependencies_parsed_at":"2025-03-28T06:22:08.389Z","dependency_job_id":"e5ab6d6e-d0c4-44e6-bbd2-a5cee1ec5853","html_url":"https://github.com/GithubSolver123/quiz-app-kubernetes","commit_stats":null,"previous_names":["githubsolver123/quiz-app-kubernetes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GithubSolver123/quiz-app-kubernetes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GithubSolver123%2Fquiz-app-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GithubSolver123%2Fquiz-app-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GithubSolver123%2Fquiz-app-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GithubSolver123%2Fquiz-app-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GithubSolver123","download_url":"https://codeload.github.com/GithubSolver123/quiz-app-kubernetes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GithubSolver123%2Fquiz-app-kubernetes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28687426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-scaling","ci-cd","cloud-native","containerization","deployment","devops","docker","flask","kubernetes","microservices","minikube","persistent-storage","quiz-app","web-application"],"created_at":"2025-04-10T00:57:52.372Z","updated_at":"2026-01-23T10:16:36.506Z","avatar_url":"https://github.com/GithubSolver123.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quiz App Kubernetes Deployment\n\nA comprehensive deployment of a Flask-based Quiz Application on Kubernetes, featuring user roles, quiz management, and automated testing capabilities.\n\n## Project Overview\n\nThis project demonstrates deploying a scalable web application using Kubernetes. The application is a quiz platform that supports:\n\n- Different user roles (admin, teacher, student)\n- Quiz creation and management\n- Timed quiz sessions\n- Results tracking and analytics\n- Persistent data storage\n\n## Technologies Used\n\n- **Backend**: Python Flask\n- **Database**: SQLite with persistent storage\n- **Containerization**: Docker\n- **Orchestration**: Kubernetes (Minikube)\n- **Authentication**: Flask-Login\n\n## Prerequisites\n\n- Docker Desktop\n- Minikube\n- kubectl\n- Python 3.9+\n- PowerShell (for Windows) or Bash (for Linux/macOS)\n\n## Deployment Architecture\n\nThe application is deployed with the following Kubernetes resources:\n\n- **Deployment**: 3 replicas of the Quiz App container\n- **Service**: NodePort service exposing the application\n- **ConfigMap**: Environment variables configuration\n- **Secret**: Sensitive data storage (credentials, keys)\n- **PersistentVolume \u0026 PVC**: For database persistence\n- **HorizontalPodAutoscaler**: Auto-scales based on CPU utilization (2-5 pods)\n\n## Quick Start\n\n### 1. Clone the repository\n```bash\ngit clone https://github.com/yourusername/quiz-app-kubernetes.git\ncd quiz-app-kubernetes\n```\n\n### 2. Start Minikube\n```bash\nminikube start --memory=2048 --cpus=2 --driver=docker\n```\n\n### 3. Configure Docker to use Minikube's daemon\n```bash\n# For PowerShell\n\u0026 minikube -p minikube docker-env | Invoke-Expression\n```\n\n### 4. Build the Docker image\n```bash\ndocker build -t quiz-app:v1 .\n```\n\n### 5. Deploy the application\n```bash\n# Apply Kubernetes manifests\nkubectl apply -f k8s/pv-pvc.yaml\nkubectl apply -f k8s/configmap.yaml\nkubectl apply -f k8s/secret.yaml\nkubectl apply -f k8s/deployment.yaml\nkubectl apply -f k8s/hpa.yaml\n\n# Enable metrics-server for HPA\nminikube addons enable metrics-server\n```\n\n### 6. Access the application\n```bash\nminikube service quiz-app-service --url\n```\n\n### 7. Automated deployment\nAlternatively, run the provided deployment script:\n```bash\n# For PowerShell\n.\\deploy.ps1\n```\n\n## Testing Scenarios\n\n### 1. Application Availability Test\n```bash\n# Check if the service is available\nkubectl get services\n\n# Test application endpoint\nminikube service quiz-app-service --url\n```\n\n### 2. Scaling Test\n```bash\n# Watch the HPA\nkubectl get hpa -w\n\n# Generate load in another terminal\nkubectl run --rm -it --image=busybox load-generator -- /bin/sh -c \"while true; do wget -q -O- http://quiz-app-service; done\"\n\n# Watch the pods increase\nkubectl get pods -w\n```\n\n### 3. Rolling Update Test\n```bash\n# Build a new version\ndocker build -t quiz-app:v2 .\n\n# Perform a rolling update\nkubectl set image deployment/quiz-app quiz-app=quiz-app:v2\n\n# Check rollout status\nkubectl rollout status deployment/quiz-app\n```\n\n### 4. Rollback Test\n```bash\n# Rollback to previous version\nkubectl rollout undo deployment/quiz-app\n\n# Check rollback status\nkubectl rollout status deployment/quiz-app\n```\n\n### 5. Pod Failure and Self-Healing Test\n```bash\n# Delete a pod and watch Kubernetes recreate it\nkubectl delete pod $(kubectl get pods -l app=quiz-app -o jsonpath=\"{.items[0].metadata.name}\")\nkubectl get pods -w\n```\n\n### 6. Persistent Storage Test\n```bash\n# Create data, delete pod, verify data persists after pod recreation\n```\n\n### 7. Logging Test\n```bash\n# View application logs\nkubectl logs $(kubectl get pods -l app=quiz-app -o jsonpath=\"{.items[0].metadata.name}\")\n```\n\n## Application Usage\n\n### Default Admin Credentials\n- Username: `admin`\n- Password: `admin123`\n\n### User Roles\n1. **Administrator**: Manages users (add/remove teachers and students)\n2. **Teacher**: Creates quizzes, views results, analyzes performance\n3. **Student**: Takes quizzes, views personal history and scores\n\n## Kubernetes Files Explained\n\n- **deployment.yaml**: Defines the application deployment with 3 replicas\n- **service.yaml**: Exposes the application via NodePort\n- **configmap.yaml**: Stores environment variables\n- **secret.yaml**: Stores sensitive data (encoded)\n- **pv-pvc.yaml**: Defines persistent storage for the database\n- **hpa.yaml**: Configures auto-scaling based on CPU utilization\n\n## Cleanup\n\n```bash\n# Delete all resources\nkubectl delete -f k8s/\n# OR\nkubectl delete all --all\n\n# Stop Minikube\nminikube stop\n```\n\n## Project Structure\n```\nquiz-app-kubernetes/\n├── app.py                  # Main Flask application\n├── requirements.txt        # Python dependencies\n├── Dockerfile              # Container definition\n├── .dockerignore           # Docker build exclusions\n├── deploy.ps1              # Deployment automation\n├── templates/              # HTML templates\n├── k8s/                    # Kubernetes manifests\n│   ├── deployment.yaml\n│   ├── configmap.yaml\n│   ├── secret.yaml\n│   ├── pv-pvc.yaml\n│   └── hpa.yaml\n```\n\n## Troubleshooting\n\n**Issue**: Pods stuck in Pending state\n**Solution**: Check PersistentVolume provisioning or resource constraints\n\n**Issue**: HPA not scaling pods\n**Solution**: Verify metrics-server is enabled (`minikube addons enable metrics-server`)\n\n**Issue**: Cannot access application\n**Solution**: Ensure service is properly configured and use `minikube service quiz-app-service`\n\n## References\n\n- [Kubernetes Documentation](https://kubernetes.io/docs/)\n- [Minikube Documentation](https://minikube.sigs.k8s.io/docs/)\n- [Flask Documentation](https://flask.palletsprojects.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubsolver123%2Fquiz-app-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithubsolver123%2Fquiz-app-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubsolver123%2Fquiz-app-kubernetes/lists"}