basic proxy ip detection test tool

This commit is contained in:
Bojan Kucera 2025-06-05 21:14:29 -04:00
commit d3cff15545
15 changed files with 1075 additions and 0 deletions

81
KUBERNETES.md Normal file
View file

@ -0,0 +1,81 @@
# Kubernetes Deployment
## Quick Start
### Prerequisites
- Kubernetes cluster running
- `kubectl` configured to access your cluster
- Docker registry access (for GitLab CI)
### Deploy to Kubernetes
**Option 1: Use deployment script**
```bash
# Linux/Mac
chmod +x deploy.sh
./deploy.sh
# Windows
deploy.bat
```
**Option 2: Manual deployment**
```bash
# 1. Create secret for API key
kubectl apply -f k8s-secret.yaml
# 2. Deploy application
kubectl apply -f k8s-deployment.yaml
# 3. Optional: Deploy ingress for external access
kubectl apply -f k8s-ingress.yaml
```
### Test the deployment
```bash
# Port forward to test locally
kubectl port-forward service/proxy-detection-service 8080:80
# Test health endpoint (no auth required)
curl http://localhost:8080/health
# Test main endpoint (requires API key)
curl -H "X-API-Key: bd406bf53ddc6abe1d9de5907830a955" http://localhost:8080/
```
### Configuration
#### Update API Key
1. Generate base64 encoded API key:
```bash
echo -n "your-new-api-key" | base64
```
2. Update `k8s-secret.yaml` with the new value
3. Apply changes:
```bash
kubectl apply -f k8s-secret.yaml
kubectl rollout restart deployment/proxy-detection-api
```
#### Update Image
Update image in `k8s-deployment.yaml` or use kubectl:
```bash
kubectl set image deployment/proxy-detection-api proxy-detection-api=your-registry/proxy-detection-api:new-tag
```
### GitLab CI/CD
The `.gitlab-ci-simple.yml` provides:
- **Build stage**: Builds and pushes Docker image to GitLab registry
- **Deploy stage**: Updates Kubernetes deployment (manual trigger)
Replace `.gitlab-ci.yml` with `.gitlab-ci-simple.yml` for the minimal pipeline.
### Resources
The deployment is configured with minimal resources:
- **Requests**: 64Mi RAM, 50m CPU
- **Limits**: 128Mi RAM, 100m CPU
- **Replicas**: 2 (for basic high availability)
Adjust these values in `k8s-deployment.yaml` based on your needs.