mirror of
https://github.com/wahyd4/you-music.git
synced 2026-08-09 05:06:44 +10:00
3.0 KiB
3.0 KiB
Kubernetes Quick Deploy Guide
🚀 Quick Start (3 Steps)
1. Build & Push Image
# Build
docker build -t ghcr.io/YOUR_USERNAME/youmusic:latest .
# Push
docker push ghcr.io/YOUR_USERNAME/youmusic:latest
2. Update Configuration
cd k8s
# Edit manifest.yaml
# - Line 57 & 88: Update image name
# - Line 177 & 180: Update domain name
# - Line 12-13: Update NFS server (if using NFS)
3. Deploy
# Validate
./validate.sh
# Deploy
kubectl apply -f manifest.yaml
# Watch
kubectl get pods -l app=youmusic -w
✅ Verification Checklist
# 1. Check migration logs
kubectl logs -l app=youmusic -c youmusic-migrations
# Expected: "✅ Migrations complete!"
# 2. Check app logs
kubectl logs -l app=youmusic -c youmusic
# Expected: "INFO: Uvicorn running on http://0.0.0.0:8000"
# 3. Check pod status
kubectl get pods -l app=youmusic
# Expected: STATUS=Running
# 4. Check ingress
kubectl get ingress youmusic-ingress
# Expected: ADDRESS assigned
# 5. Test application
curl https://YOUR_DOMAIN.com
# Expected: HTML response
🔧 Common Commands
# View logs
kubectl logs -f -l app=youmusic -c youmusic
# Restart pod
kubectl rollout restart deployment/youmusic
# Delete and redeploy
kubectl delete -f manifest.yaml
kubectl apply -f manifest.yaml
# Check resources
kubectl describe pod -l app=youmusic
# Port forward for testing
kubectl port-forward svc/youmusic 8080:80
📊 Status Check
# Everything
kubectl get all -l app=youmusic
# Detailed pod info
kubectl describe pod -l app=youmusic
# Events
kubectl get events --sort-by=.metadata.creationTimestamp | tail -20
🛠 Troubleshooting
Pod Stuck in Init
kubectl logs -l app=youmusic -c youmusic-migrations
Fix: Check database permissions, delete pod to retry
CrashLoopBackOff
kubectl logs -l app=youmusic -c youmusic --previous
Fix: Check application logs for errors
Image Pull Error
kubectl describe pod -l app=youmusic
Fix: Create/check imagePullSecret
📦 What Gets Created
- ✅ PersistentVolume (100Gi NFS)
- ✅ PersistentVolumeClaim
- ✅ Deployment (1 replica with init container)
- ✅ Service (ClusterIP on port 80)
- ✅ Ingress (with TLS and auth)
⚠️ Important Notes
- Single Replica Only - SQLite limitation
- Migrations Auto-Run - Init container handles it
- NFS Required - For persistent storage
- Domain Required - For ingress/TLS
🔄 Update Process
# Build new version
docker build -t ghcr.io/YOUR_USERNAME/youmusic:v2 .
docker push ghcr.io/YOUR_USERNAME/youmusic:v2
# Update image
kubectl set image deployment/youmusic \
youmusic=ghcr.io/YOUR_USERNAME/youmusic:v2
# Check rollout
kubectl rollout status deployment/youmusic
📚 Full Documentation
- Detailed guide:
k8s/README.md - Review document:
K8S_REVIEW.md - Manifest:
k8s/manifest.yaml
Ready to deploy? Run: kubectl apply -f k8s/manifest.yaml