-
Notifications
You must be signed in to change notification settings - Fork 245
Prediction Container Deployment
Arsalan edited this page Sep 11, 2025
·
2 revisions
This page documents the prediction endpoint container added to the Avatar Kubernetes deployment as part of PR #308 to address issue #36.
- Prediction container running on port 5000
- Nginx ConfigMap for reverse proxy routing
- Updated k8s.yaml with container and volume configurations
- Image: docker.io/jdknuds/prediction:latest
- Port: 5000
- Name: prediction-pod
-
Endpoints:
-
/eegrandomforestprediction(POST) - Submit EEG data for prediction -
/lastprediction(GET) - Retrieve most recent prediction
-
The prediction container uses gunicorn as the production WSGI server instead of Flask's development server for improved performance and reliability.
Gunicorn Configuration:
- Workers: 2 worker processes
- Binding: 0.0.0.0:5000 (all interfaces)
-
Command:
gunicorn --bind 0.0.0.0:5000 --workers 2 server.server:app
This configuration provides better concurrent request handling and follows production deployment best practices for Python web applications.
- Apply the ConfigMap first:
kubectl apply -f nginx-configmap.yaml - Apply the main pod:
kubectl apply -f k8s.yaml - Verify containers are running:
kubectl get pods
The nginx container acts as a reverse proxy, routing:
- Default traffic (/) → Jupyter service (port 8888)
- Prediction requests → Prediction service (port 5000)
All prediction requests are automatically routed through nginx to the gunicorn-powered prediction service, ensuring proper load balancing and production-ready deployment.
-
server/devops/deployment/k8s.yaml- Added prediction container with gunicorn command and nginx volume mount -
server/devops/deployment/nginx-configmap.yaml- New ConfigMap for nginx configuration -
server/devops/nginx/nginx.conf- Nginx reverse proxy configuration
The implementation includes:
- Kubernetes pod configuration with 4 containers (Jupyter, Nginx, Prediction, Rust)
- ConfigMap-based nginx configuration for flexible routing
- Production-ready WSGI server setup with gunicorn
- Proper security contexts and resource management
- Pull Request: #308
- Original Issue: #36