Spaces:
Running
on
Zero
Docker Desktop + Kubernetes Setup for Warbler CDA
Since you're using Docker, you can test the Kubernetes deployment locally using Docker Desktop's built-in Kubernetes feature.
Prerequisites
Enable Kubernetes in Docker Desktop:
- Open Docker Desktop
- Go to Settings → Kubernetes
- Check "Enable Kubernetes"
- Apply & Restart
Verify Kubernetes is running:
kubectl cluster-info kubectl get nodes
Quick Start with Docker Desktop K8s
Option 1: Use the deployment script
cd k8s
./deploy.sh
Option 2: Manual deployment
- Build and load image directly to Docker Desktop:
# Build the image
docker build -t warbler-cda:latest .
# The image is now available to K8s since Docker Desktop shares images
- Deploy to local Kubernetes:
cd k8s
kubectl apply -f .
- Check deployment:
kubectl get pods -n warbler-cda
kubectl get svc -n warbler-cda
kubectl get ingress -n warbler-cda
- Access the application:
Option A: Use port-forwarding (recommended for development)
kubectl port-forward svc/warbler-cda-service 8001:80 -n warbler-cda
Then visit: http://localhost:8001/health
Option B: Access via Ingress (requires ingress controller)
First, enable ingress in Docker Desktop and install NGINX Ingress:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml
Then update your ingress.yaml to use a local domain or use port forwarding.
Compare: Docker Compose vs Kubernetes
| Feature | Docker Compose | Kubernetes |
|---|---|---|
| Scaling | Manual replica adjustment | Auto-scaling, rolling updates |
| Networking | Simple service discovery | Complex service mesh |
| Storage | Local volumes | Persistent volumes, storage classes |
| Health Checks | Basic | Liveness/readiness probes |
| Resource Limits | Basic | Detailed QoS, limits/requests |
| Environment | Single host | Multi-node clusters |
Local Development Workflow
Develop with Docker Compose (faster iteration):
docker-compose up --buildTest production deployment with Kubernetes:
cd k8s && ./deploy.sh kubectl port-forward svc/warbler-cda-service 8001:80 -n warbler-cdaDebug if needed:
kubectl logs -f deployment/warbler-cda -n warbler-cda kubectl describe pod -n warbler-cda
Benefits of Docker Desktop Kubernetes
- Same deployment as production - test your exact K8s manifests
- Resource isolation - proper containerization like production
- Networking simulation - test service communication
- Storage testing - validate PVC behavior
- Health check validation - ensure probes work correctly
Troubleshooting Docker Desktop K8s
Common issues:
"ImagePullBackOff" error:
- Make sure you built the image:
docker build -t warbler-cda:latest . - Update deployment.yaml image to
warbler-cda:latest
- Make sure you built the image:
PVC pending:
- Docker Desktop K8s has storage classes, but storage might not provision immediately
- Check:
kubectl get pvc -n warbler-cda - You can use hostPath storage for local testing
Ingress not working:
- Install ingress controller first
- Use port-forwarding for simpler local access
Resource constraints:
- Docker Desktop K8s shares resources with Docker
- Reduce resource requests in deployment.yaml if needed
Converting Docker Compose to Kubernetes
Your docker-compose.yml has been converted to K8s with these mappings:
| Docker Compose | Kubernetes Equivalent |
|---|---|
image: . |
deployment.yaml with image build step |
ports: - "8001:8000" |
service.yaml + ingress.yaml |
environment: |
configmap.yaml + envFrom |
volumes: ./data:/app/data |
pvc.yaml + volumeMounts |
restart: unless-stopped |
Deployment with replicas |
The Kubernetes setup provides production-grade features while maintaining the same application behavior as your Docker Compose setup.