Docker Desktop / Minikube
↓
Kubernetes Cluster (uploadstream namespace)
├── PostgreSQL StatefulSet (1 pod)
├── UploadStream Deployment (2-5 pods, auto-scaling)
├── Services (ClusterIP + LoadBalancer)
└── Persistent Volumes (postgres + file storage)
# Build locally
docker build -t uploadstream:latest .
# Verify image
docker images | grep uploadstreamcd k8s
chmod +x deploy.sh
./deploy.shkubectl -n uploadstream get all
kubectl -n uploadstream get pods -w # Watch pod creation# Port-forward to test
kubectl -n uploadstream port-forward svc/uploadstream 50051:50051 &
# In another terminal, run client
go run cmd/client/main.go| File | Purpose |
|---|---|
01-namespace.yaml |
Create uploadstream namespace |
02-secrets.yaml |
DB credentials (encrypted at rest) |
03-configmap.yaml |
App configuration |
04-pvc.yaml |
Persistent volume claims |
05-postgres.yaml |
PostgreSQL StatefulSet |
06-migrations-configmap.yaml |
Database migrations |
07-uploadstream.yaml |
App Deployment + Service |
08-hpa.yaml |
Auto-scaling configuration |
09-loadbalancer.yaml |
External LoadBalancer service |
kubectl -n uploadstream logs -l app=uploadstream -f
kubectl -n uploadstream logs postgres-0 -fkubectl -n uploadstream scale deployment uploadstream --replicas=4# After code changes:
docker build -t uploadstream:latest .
kubectl -n uploadstream rollout restart deployment uploadstream
kubectl -n uploadstream rollout status deployment uploadstream./cleanup.sh
# Or: kubectl delete namespace uploadstreamAuto-scaling - 2-5 replicas based on CPU/memory
Health checks - Liveness & readiness probes
Resource limits - CPU and memory quotas
Persistent storage - 10GB postgres + 50GB file storage
Database migrations - Automatic on startup
Service discovery - Internal and external access
Graceful shutdown - Pod disruption budgets (optional)
- Change DB password in
02-secrets.yaml - Use external database (AWS RDS, Cloud SQL, etc.)
- Push image to registry (Docker Hub, ECR, GCR, etc.)
- Enable TLS for gRPC (add Ingress with cert)
- Configure RBAC and network policies
- Set resource quotas per namespace
- Implement backup strategy for persistent volumes
- Use secrets management (Vault, AWS Secrets Manager)