3.8 KiB
3.8 KiB
✅ Kubernetes Setup - Ready to Deploy!
🎯 Everything is Configured and Ready
✅ What's Set Up
-
Kubernetes Manifests (
kubernetes/manifests/)- ✅
namespace.yaml- Namespace for your app - ✅
secrets.yaml- NATS credentials and external API config - ✅
fastapi-deployment.yaml- FastAPI backend (4 replicas, auto-scaling) - ✅
fastapi-service.yaml- Service on port 8000 - ✅
fastapi-hpa.yaml- Horizontal Pod Autoscaler (4-20 pods) - ✅
worker-deployment.yaml- NATS workers (2 replicas, auto-scaling) - ✅
worker-hpa.yaml- Worker autoscaler (2-10 pods) - ✅
gateway.yaml- Gateway API (ports 8201/8441 - no conflict with Traefik) - ✅
dashboard.yaml- Kubernetes Dashboard UI
- ✅
-
Deployment Scripts
- ✅
simple-deploy.sh- One-command deployment - ✅
deploy-dashboard.sh- Dashboard deployment - ✅
setup-jetstream.sh- JetStream setup
- ✅
-
Configuration
- ✅ Port conflicts resolved (8201/8441 instead of 80/443)
- ✅ Image pull policy set to
Never(uses local containerd images) - ✅ NATS connection configured (external NATS server)
- ✅ External API endpoints configured
- ✅ HTTP methods correctly forwarded (PUT for update delivery)
-
Documentation
- ✅
DEPLOY_CHECKLIST.md- Step-by-step deployment guide - ✅
DASHBOARD_SETUP.md- Dashboard access guide - ✅
README.md- Main documentation
- ✅
🚀 Quick Deployment Steps
Step 1: Start k3s (if not running)
sudo systemctl start k3s
sudo systemctl status k3s
Step 2: Build and Import Docker Images
cd ~/kubernetes
# Build images
docker build -t fastapi-backend:latest --target api -f Dockerfile .
docker build -t nats-worker:latest --target worker -f Dockerfile .
# Import to containerd (k3s uses containerd)
docker save fastapi-backend:latest | sudo k3s ctr images import -
docker save nats-worker:latest | sudo k3s ctr images import -
Step 3: Setup JetStream
chmod +x setup-jetstream.sh
./setup-jetstream.sh
Step 4: Deploy Everything
chmod +x simple-deploy.sh
./simple-deploy.sh
Step 5: Deploy Dashboard (Optional)
chmod +x deploy-dashboard.sh
./deploy-dashboard.sh
🔍 Verify Deployment
# Check pods
kubectl get pods -n nats-backend
# Check services
kubectl get svc -n nats-backend
# Check Gateway
kubectl get gateway -n nats-backend
# Check HPA
kubectl get hpa -n nats-backend
🖥️ Access Dashboard
# Start proxy
kubectl proxy
# Visit in browser:
# http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
Or use port-forward:
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 9090:9090
# Visit: http://localhost:9090
📊 What You'll See in Dashboard
- Namespaces:
nats-backend,kubernetes-dashboard - Pods: FastAPI pods, Worker pods, Dashboard pod
- Services: FastAPI service, Dashboard service
- Deployments: All your deployments
- HPA: Autoscaling configurations
- Resources: CPU, Memory usage
- Logs: View logs from any pod
- Events: Cluster events and errors
⚙️ Configuration Summary
| Component | Configuration |
|---|---|
| FastAPI | 4 initial pods, scales 4-20, port 8000 |
| Workers | 2 initial pods, scales 2-10 |
| Gateway | Ports 8201 (HTTP), 8441 (HTTPS) |
| NATS | External: nats://nats.workolik.com:4222 |
| Domain | queue.workolik.com |
| External API | https://jupiter.nearle.app |
✅ All Systems Ready!
Everything is configured and ready to deploy. Just follow the steps above!
Need help? Check:
DEPLOY_CHECKLIST.md- Detailed deployment guideDASHBOARD_SETUP.md- Dashboard access optionsREADME.md- Full documentation
🎉 You're all set!