{"id":31324690,"url":"https://github.com/javadtorabikh/microservices-k8s-lab","last_synced_at":"2026-04-11T04:32:04.979Z","repository":{"id":316434040,"uuid":"1063338109","full_name":"JavadTorabiKh/microservices-k8s-lab","owner":"JavadTorabiKh","description":"🚀 Complete Kubernetes Microservices Lab | FastAPI , Node.js , Vue.js  , Redis A practical guide to building, deploying, and scaling microservices on Kubernetes. Perfect for developers learning cloud-native development.","archived":false,"fork":false,"pushed_at":"2025-09-24T14:17:59.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T16:25:21.587Z","etag":null,"topics":["api-gateway","cloud-native","devops","distributed-systems","docker","fastapi","hands-on-lab","kubernetes","microservices","nodejs","tutorial","vuejs"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JavadTorabiKh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T13:43:01.000Z","updated_at":"2025-09-24T14:20:10.000Z","dependencies_parsed_at":"2025-09-24T16:28:10.693Z","dependency_job_id":"72c2f9c5-a0ee-4e18-bf80-257417eff71f","html_url":"https://github.com/JavadTorabiKh/microservices-k8s-lab","commit_stats":null,"previous_names":["javadtorabikh/microservices-k8s-lab"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/JavadTorabiKh/microservices-k8s-lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavadTorabiKh%2Fmicroservices-k8s-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavadTorabiKh%2Fmicroservices-k8s-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavadTorabiKh%2Fmicroservices-k8s-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavadTorabiKh%2Fmicroservices-k8s-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JavadTorabiKh","download_url":"https://codeload.github.com/JavadTorabiKh/microservices-k8s-lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JavadTorabiKh%2Fmicroservices-k8s-lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276986412,"owners_count":25740551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api-gateway","cloud-native","devops","distributed-systems","docker","fastapi","hands-on-lab","kubernetes","microservices","nodejs","tutorial","vuejs"],"created_at":"2025-09-25T21:28:17.134Z","updated_at":"2025-12-30T21:21:07.097Z","avatar_url":"https://github.com/JavadTorabiKh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Microservices System with Kubernetes\n\nA complete educational project demonstrating microservices architecture and Kubernetes deployment.\n\n## 🏗️ System Architecture\n\n```mermaid\ngraph TB\n    A[User] --\u003e B[API Gateway]\n    B --\u003e C[Frontend Service]\n    B --\u003e D[Auth Service]\n    B --\u003e E[Products Service]\n    D --\u003e F[Redis Cache]\n    E --\u003e F\n    C --\u003e G[Static Files]\n    \n    style A fill:#e1f5fe\n    style B fill:#f3e5f5\n    style C fill:#e8f5e8\n    style D fill:#fff3e0\n    style E fill:#fce4ec\n    style F fill:#ffebee\n```\n\n## System Components:\n |Component |\tTechnology |\tPort |\tDescription |\n |----------|--------|-------------|------------|\n |Frontend |\tVue.js + Nginx |\t80 |\tUser Interface |\n |Auth Service |\tPython FastAPI |\t8001 |\tAuthentication management |\n |Products Service |\tNode.js Express |\t8002 |\tProducts management |\n |API Gateway |\tNginx |\t80 |\tRequest routing \u0026 load balancing |\n |Redis |\tRedis |\t6379 |\tShared caching layer |\n \n## 🎯 Microservices\n\n#### 1. Auth Service (/auth-service)\n   \n  - Technology: Python FastAPI\n  - Responsibility: User authentication and session management\n  - Features: JWT-like tokens, Redis session storage\n  - API Endpoints:\n  \n    - POST /login - User authentication\n    - GET /users/{username} - Get user info\n\n#### 2. Products Service (/products-service)\n\n  - Technology: Node.js + Express\n  - Responsibility: Product catalog management\n  - Features: Redis caching, product inventory\n  - API Endpoints:\n  \n    - GET /products - List all products\n    - GET /products/{id} - Get product details\n\n#### 3. Frontend Service (/frontend)\n  - Technology: Vue.js + Nginx\n  - Responsibility: User interface\n  - Features: Responsive design, API integration\n\n#### 4. API Gateway (/api-gateway)\n  - Technology: Nginx\n  - Responsibility: Request routing, load balancing\n  - Features: URL rewriting, service discovery\n\n## ⚙️ Prerequisites\n#### Required Software:\n  - Docker 20.10+\n  - Kubernetes 1.25+ (or Minikube/Docker Desktop)\n  - kubectl 1.25+\n  - Git 2.30+\n\n#### Optional (for local development):\n  - Python 3.11+\n  - Node.js 18+\n  - Redis 7+\n\n## 🚀 Installation \u0026 Setup\n#### 1. Clone the Repository\n```bash\n  git clone https://github.com/your-username/microservices-k8s.git\n  cd microservices-k8s\n```\n#### 2. Build Docker Images\n```bash\n  # Build all services\n  docker build -t auth-service:latest auth-service/\n  docker build -t products-service:latest products-service/\n  docker build -t frontend:latest frontend/\n  docker build -t api-gateway:latest api-gateway/\n```\n#### 3. Start Kubernetes Cluster\n```bash\n  # Using Minikube\n  minikube start --driver=docker --memory=4096 --cpus=2\n  \n  # Or using Docker Desktop Kubernetes\n  # Enable Kubernetes from Docker Desktop settings\n```\n\n## ☸️ Kubernetes Deployment\n#### 1. Create Namespace\n```bash\n  kubectl apply -f k8s/namespace.yml\n```\n#### 2. Deploy Redis\n```bash\n  kubectl apply -f k8s/redis-deployment.yml\n```\n\n#### 3. Deploy Microservices\n```bash\n  # Deploy all services\n  kubectl apply -f k8s/auth-deployment.yml\n  kubectl apply -f k8s/products-deployment.yml\n  kubectl apply -f k8s/frontend-deployment.yml\n  kubectl apply -f k8s/gateway-deployment.yml\n```\n\n#### 4. Verify Deployment\n```bash\n  # Check all pods\n  kubectl get pods -n microservices\n  \n  # Check services\n  kubectl get services -n microservices\n  \n  # Check deployment status\n  kubectl get deployments -n microservices\n```\n\n## 🧪 Testing\n#### 1. Access the Application\n```bash\n  # Get gateway URL\n  minikube service api-gateway -n microservices --url\n  # Output: http://192.168.49.2:30000\n```\n\n#### 2. Test API Endpoints\n```bash\n  # Test auth service\n  curl http://192.168.49.2:30000/auth/\n  \n  # Test products service\n  curl http://192.168.49.2:30000/products/products\n  \n  # Test login\n  curl -X POST http://192.168.49.2:30000/auth/login \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n#### 3. Test Frontend\n\nOpen in browser: http://192.168.49.2:30000\n\n## 📈 Scaling\n\nScale Auth Service\n```bash\n  kubectl scale deployment auth-service --replicas=3 -n microservices\n```\n\nScale Products Service\n\n```bash\n  kubectl scale deployment products-service --replicas=3 -n microservices\n```\n\nAuto-scaling (HPA)\n```bash\n  # Create Horizontal Pod Autoscaler\n  kubectl autoscale deployment auth-service --cpu-percent=50 --min=1 --max=5 -n microservices\n```\n\n## 📊 Monitoring\n\nView Logs\n```bash\n# View auth service logs\nkubectl logs -l app=auth-service -n microservices\n\n# Follow logs in real-time\nkubectl logs -f deployment/auth-service -n microservices\n```\n\nResource Usage\n```bash\n# Check resource usage\nkubectl top pods -n microservices\n\n# Check node resources\nkubectl top nodes\n```\n\nPort Forwarding for Debugging\n```bash\n# Access Redis directly\nkubectl port-forward svc/redis-service 6379:6379 -n microservices\n\n# Access auth service\nkubectl port-forward svc/auth-service 8001:8001 -n microservices\n```\n\n## 🔧 Development \u0026 Debugging\n\nLocal Development\n```bash\n# Run auth service locally\ncd auth-service\npython -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\nuvicorn app.main:app --reload --port 8001\n\n# Run products service locally\ncd products-service\nnpm install\nnpm start\n\n# Run frontend locally\ncd frontend\npython -m http.server 8080\n```\n\nKubernetes Debugging Commands\n\n```bash\n# Get detailed pod information\nkubectl describe pod \u003cpod-name\u003e -n microservices\n\n# Execute command in pod\nkubectl exec -it \u003cpod-name\u003e -n microservices -- /bin/sh\n\n# View service endpoints\nkubectl get endpoints -n microservices\n```\n\n## 🤝 Contributing\n\nDevelopment Workflow\n\n- Fork the repository\n- Create a feature branch (git checkout -b feature/amazing-feature)\n- Commit changes (git commit -m 'Add amazing feature')\n- Push to branch (git push origin feature/amazing-feature)\n- Open a Pull Request\n\nAdding New Services\n\n- Create service directory with Dockerfile\n- Add Kubernetes deployment files\n- Update API gateway configuration\n- Update this README with service documentation\n\n## 🐛 Troubleshooting\n\nCommon Issues:\nPods in CrashLoopBackOff:\n\n```bash\nkubectl describe pod \u003cpod-name\u003e -n microservices\nkubectl logs \u003cpod-name\u003e -n microservices\n```\n\nServices not connecting:\n\n```bash\n# Check service DNS resolution\nkubectl run debug-pod --image=busybox -it --rm -n microservices -- nslookup redis-service\n```\n\nImage pull errors:\n\n```bash\n# Load images to Minikube\nminikube image load auth-service:latest\nminikube image load products-service:latest\n```\n\n## 🙏 Acknowledgments\n\n- Kubernetes community for excellent documentation\n- Docker for containerization technology\n- FastAPI and Express.js frameworks\n\n## Happy Coding! 🚀\n\n### For questions and support, please open an issue in the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadtorabikh%2Fmicroservices-k8s-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavadtorabikh%2Fmicroservices-k8s-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadtorabikh%2Fmicroservices-k8s-lab/lists"}