|
| 1 | +# OpenShift Deployment for Semantic Router |
| 2 | + |
| 3 | +This directory contains OpenShift-specific deployment manifests for the vLLM Semantic Router. |
| 4 | + |
| 5 | +## Quick Deployment |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- OpenShift cluster access |
| 10 | +- `oc` CLI tool configured and logged in |
| 11 | +- Cluster admin privileges (or permissions to create namespaces and routes) |
| 12 | + |
| 13 | +### One-Command Deployment |
| 14 | + |
| 15 | +```bash |
| 16 | +oc apply -k deploy/openshift/ |
| 17 | +``` |
| 18 | + |
| 19 | +### Step-by-Step Deployment |
| 20 | + |
| 21 | +1. **Create namespace:** |
| 22 | + |
| 23 | + ```bash |
| 24 | + oc apply -f deploy/openshift/namespace.yaml |
| 25 | + ``` |
| 26 | + |
| 27 | +2. **Deploy core resources:** |
| 28 | + |
| 29 | + ```bash |
| 30 | + oc apply -f deploy/openshift/pvc.yaml |
| 31 | + oc apply -f deploy/openshift/deployment.yaml |
| 32 | + oc apply -f deploy/openshift/service.yaml |
| 33 | + ``` |
| 34 | + |
| 35 | +3. **Create external routes:** |
| 36 | + |
| 37 | + ```bash |
| 38 | + oc apply -f deploy/openshift/routes.yaml |
| 39 | + ``` |
| 40 | + |
| 41 | +## Accessing Services |
| 42 | + |
| 43 | +After deployment, the services will be accessible via OpenShift Routes: |
| 44 | + |
| 45 | +### Get Route URLs |
| 46 | + |
| 47 | +```bash |
| 48 | +# Classification API (HTTP REST) |
| 49 | +oc get route semantic-router-api -n vllm-semantic-router-system -o jsonpath='{.spec.host}' |
| 50 | + |
| 51 | +# gRPC API |
| 52 | +oc get route semantic-router-grpc -n vllm-semantic-router-system -o jsonpath='{.spec.host}' |
| 53 | + |
| 54 | +# Metrics |
| 55 | +oc get route semantic-router-metrics -n vllm-semantic-router-system -o jsonpath='{.spec.host}' |
| 56 | +``` |
| 57 | + |
| 58 | +### Example Usage |
| 59 | + |
| 60 | +```bash |
| 61 | +# Get the API route |
| 62 | +API_ROUTE=$(oc get route semantic-router-api -n vllm-semantic-router-system -o jsonpath='{.spec.host}') |
| 63 | + |
| 64 | +# Test health endpoint |
| 65 | +curl https://$API_ROUTE/health |
| 66 | + |
| 67 | +# Test classification |
| 68 | +curl -X POST https://$API_ROUTE/api/v1/classify/intent \ |
| 69 | + -H "Content-Type: application/json" \ |
| 70 | + -d '{"text": "What is machine learning?"}' |
| 71 | +``` |
| 72 | + |
| 73 | +## Architecture Differences from Kubernetes |
| 74 | + |
| 75 | +### Security Context |
| 76 | + |
| 77 | +- Removed `runAsNonRoot: false` for OpenShift compatibility |
| 78 | +- Enhanced security context with `capabilities.drop: ALL` and `seccompProfile` |
| 79 | +- OpenShift automatically enforces non-root containers |
| 80 | + |
| 81 | +### Networking |
| 82 | + |
| 83 | +- Uses OpenShift Routes instead of port-forwarding for external access |
| 84 | +- TLS termination handled by OpenShift router |
| 85 | +- Automatic HTTPS certificates via OpenShift |
| 86 | + |
| 87 | +### Storage |
| 88 | + |
| 89 | +- Uses OpenShift's default storage class |
| 90 | +- PVC automatically bound to available storage |
| 91 | + |
| 92 | +## Monitoring |
| 93 | + |
| 94 | +### Check Deployment Status |
| 95 | + |
| 96 | +```bash |
| 97 | +# Check pods |
| 98 | +oc get pods -n vllm-semantic-router-system |
| 99 | + |
| 100 | +# Check services |
| 101 | +oc get services -n vllm-semantic-router-system |
| 102 | + |
| 103 | +# Check routes |
| 104 | +oc get routes -n vllm-semantic-router-system |
| 105 | + |
| 106 | +# Check logs |
| 107 | +oc logs -f deployment/semantic-router -n vllm-semantic-router-system |
| 108 | +``` |
| 109 | + |
| 110 | +### Metrics |
| 111 | + |
| 112 | +Access Prometheus metrics via the metrics route: |
| 113 | + |
| 114 | +```bash |
| 115 | +METRICS_ROUTE=$(oc get route semantic-router-metrics -n vllm-semantic-router-system -o jsonpath='{.spec.host}') |
| 116 | +curl https://$METRICS_ROUTE/metrics |
| 117 | +``` |
| 118 | + |
| 119 | +## Cleanup |
| 120 | + |
| 121 | +Remove all resources: |
| 122 | + |
| 123 | +```bash |
| 124 | +oc delete -k deploy/openshift/ |
| 125 | +``` |
| 126 | + |
| 127 | +Or remove individual components: |
| 128 | + |
| 129 | +```bash |
| 130 | +oc delete -f deploy/openshift/routes.yaml |
| 131 | +oc delete -f deploy/openshift/service.yaml |
| 132 | +oc delete -f deploy/openshift/deployment.yaml |
| 133 | +oc delete -f deploy/openshift/pvc.yaml |
| 134 | +oc delete -f deploy/openshift/namespace.yaml |
| 135 | +``` |
| 136 | + |
| 137 | +## Troubleshooting |
| 138 | + |
| 139 | +### Common Issues |
| 140 | + |
| 141 | +**1. Pod fails to start due to security context:** |
| 142 | + |
| 143 | +```bash |
| 144 | +oc describe pod -l app=semantic-router -n vllm-semantic-router-system |
| 145 | +``` |
| 146 | + |
| 147 | +**2. Storage issues:** |
| 148 | + |
| 149 | +```bash |
| 150 | +oc get pvc -n vllm-semantic-router-system |
| 151 | +oc describe pvc semantic-router-models -n vllm-semantic-router-system |
| 152 | +``` |
| 153 | + |
| 154 | +**3. Route not accessible:** |
| 155 | + |
| 156 | +```bash |
| 157 | +oc get routes -n vllm-semantic-router-system |
| 158 | +oc describe route semantic-router-api -n vllm-semantic-router-system |
| 159 | +``` |
| 160 | + |
| 161 | +### Resource Requirements |
| 162 | + |
| 163 | +The deployment requires: |
| 164 | + |
| 165 | +- **Memory**: 3Gi request, 6Gi limit |
| 166 | +- **CPU**: 1 core request, 2 cores limit |
| 167 | +- **Storage**: 10Gi for model storage |
| 168 | + |
| 169 | +Adjust resource limits in `deployment.yaml` if needed for your cluster capacity. |
| 170 | + |
| 171 | +## Files Overview |
| 172 | + |
| 173 | +- `namespace.yaml` - Namespace with OpenShift-specific annotations |
| 174 | +- `pvc.yaml` - Persistent volume claim for model storage |
| 175 | +- `deployment.yaml` - Main application deployment with OpenShift security contexts |
| 176 | +- `service.yaml` - Services for gRPC, HTTP API, and metrics |
| 177 | +- `routes.yaml` - OpenShift routes for external access |
| 178 | +- `config.yaml` - Application configuration |
| 179 | +- `tools_db.json` - Tools database for semantic routing |
| 180 | +- `kustomization.yaml` - Kustomize configuration for easy deployment |
0 commit comments