✅ Validation Results: - PPO training: 24.2s (1 epoch, 950 samples, dim=225) - Feature extraction: 105μs/bar (9.5x faster than target) - Model checkpoint: 293KB (147KB actor + 146KB critic) - GPU memory: 145MB used (96.4% headroom) - Zero dimension mismatches 📊 Success Criteria (5/5): ✅ Feature dimension = 225 (Wave C 201 + Wave D 24) ✅ Model state_dim = 225 ✅ Training completed without errors ✅ Checkpoint saved successfully ✅ No dimension mismatch errors 📁 Training Data Ready: - ES.FUT: 2.9MB, 180 days - NQ.FUT: 4.4MB, 180 days - 6E.FUT: 2.8MB, 180 days - ZN.FUT: 65KB, 90 days (clean) 🚀 Next: Full production model retraining (4 models, ~10min GPU time) 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
432 lines
8.1 KiB
YAML
432 lines
8.1 KiB
YAML
# Foxhunt HFT Trading System - Complete Kubernetes Deployment
|
|
# Wave 5 Production Deployment Infrastructure
|
|
#
|
|
# This manifest includes:
|
|
# - Namespace
|
|
# - ConfigMaps (3)
|
|
# - Secrets (2)
|
|
# - PersistentVolumeClaims (5)
|
|
# - Services (5)
|
|
# - HorizontalPodAutoscalers (3)
|
|
#
|
|
# Usage: kubectl apply -f k8s/foxhunt-complete.yaml
|
|
|
|
---
|
|
# Namespace
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: foxhunt
|
|
labels:
|
|
name: foxhunt
|
|
environment: production
|
|
|
|
---
|
|
# ConfigMap: Main configuration
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: foxhunt-config
|
|
namespace: foxhunt
|
|
data:
|
|
redis-url: "redis://redis:6379"
|
|
vault-addr: "http://vault:8200"
|
|
postgres-host: "postgres"
|
|
postgres-port: "5432"
|
|
postgres-db: "foxhunt"
|
|
|
|
---
|
|
# ConfigMap: Prometheus configuration
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: prometheus-config
|
|
namespace: foxhunt
|
|
data:
|
|
prometheus.yml: |
|
|
global:
|
|
scrape_interval: 15s
|
|
evaluation_interval: 15s
|
|
scrape_configs:
|
|
- job_name: 'api-gateway'
|
|
static_configs:
|
|
- targets: ['api-gateway:9091']
|
|
- job_name: 'trading-service'
|
|
static_configs:
|
|
- targets: ['trading-service:9092']
|
|
- job_name: 'backtesting-service'
|
|
static_configs:
|
|
- targets: ['backtesting-service:9093']
|
|
- job_name: 'ml-training-service'
|
|
static_configs:
|
|
- targets: ['ml-training-service:9094']
|
|
- job_name: 'trading-agent-service'
|
|
static_configs:
|
|
- targets: ['trading-agent-service:9095']
|
|
|
|
---
|
|
# ConfigMap: Redis configuration
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: redis-config
|
|
namespace: foxhunt
|
|
data:
|
|
redis.conf: |
|
|
maxmemory 256mb
|
|
maxmemory-policy allkeys-lru
|
|
appendonly yes
|
|
save 900 1
|
|
save 300 10
|
|
save 60 10000
|
|
|
|
---
|
|
# Secret: Database credentials (base64 encoded)
|
|
# IMPORTANT: Replace with actual values from Vault in production
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: foxhunt-secrets
|
|
namespace: foxhunt
|
|
type: Opaque
|
|
stringData:
|
|
jwt-secret: "REPLACE_WITH_VAULT_VALUE"
|
|
database-url: "postgresql://foxhunt:REPLACE_PASSWORD@postgres:5432/foxhunt"
|
|
vault-token: "REPLACE_WITH_VAULT_TOKEN"
|
|
aws-access-key-id: "REPLACE_WITH_AWS_KEY"
|
|
aws-secret-access-key: "REPLACE_WITH_AWS_SECRET"
|
|
|
|
---
|
|
# Secret: Vault credentials
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: vault-secrets
|
|
namespace: foxhunt
|
|
type: Opaque
|
|
stringData:
|
|
vault-root-token: "REPLACE_WITH_VAULT_ROOT_TOKEN"
|
|
vault-unseal-key: "REPLACE_WITH_VAULT_UNSEAL_KEY"
|
|
|
|
---
|
|
# PVC: PostgreSQL data
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: postgres-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 100Gi
|
|
storageClassName: fast-ssd
|
|
|
|
---
|
|
# PVC: Redis data
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: redis-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 10Gi
|
|
storageClassName: fast-ssd
|
|
|
|
---
|
|
# PVC: Prometheus data
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: prometheus-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 50Gi
|
|
storageClassName: standard
|
|
|
|
---
|
|
# PVC: ML Models
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ml-models-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 50Gi
|
|
storageClassName: fast-ssd
|
|
|
|
---
|
|
# PVC: ML Checkpoints
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ml-checkpoints-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 100Gi
|
|
storageClassName: fast-ssd
|
|
|
|
---
|
|
# PVC: Backtesting Data
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: backtesting-data-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 200Gi
|
|
storageClassName: standard
|
|
|
|
---
|
|
# PVC: Backtesting Results
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: backtesting-results-pvc
|
|
namespace: foxhunt
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 50Gi
|
|
storageClassName: standard
|
|
|
|
---
|
|
# Service: Backtesting Service
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: backtesting-service
|
|
namespace: foxhunt
|
|
labels:
|
|
app: backtesting-service
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9093"
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: backtesting-service
|
|
ports:
|
|
- name: grpc
|
|
port: 50053
|
|
targetPort: 50053
|
|
protocol: TCP
|
|
- name: metrics
|
|
port: 9093
|
|
targetPort: 9093
|
|
protocol: TCP
|
|
- name: health
|
|
port: 8082
|
|
targetPort: 8082
|
|
protocol: TCP
|
|
|
|
---
|
|
# Service: ML Training Service
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: ml-training-service
|
|
namespace: foxhunt
|
|
labels:
|
|
app: ml-training-service
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9094"
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: ml-training-service
|
|
ports:
|
|
- name: grpc
|
|
port: 50054
|
|
targetPort: 50054
|
|
protocol: TCP
|
|
- name: metrics
|
|
port: 9094
|
|
targetPort: 9094
|
|
protocol: TCP
|
|
- name: health
|
|
port: 8095
|
|
targetPort: 8095
|
|
protocol: TCP
|
|
|
|
---
|
|
# Service: Trading Agent Service
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: trading-agent-service
|
|
namespace: foxhunt
|
|
labels:
|
|
app: trading-agent-service
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9095"
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: trading-agent-service
|
|
ports:
|
|
- name: grpc
|
|
port: 50055
|
|
targetPort: 50055
|
|
protocol: TCP
|
|
- name: metrics
|
|
port: 9095
|
|
targetPort: 9095
|
|
protocol: TCP
|
|
- name: health
|
|
port: 8083
|
|
targetPort: 8083
|
|
protocol: TCP
|
|
|
|
---
|
|
# HPA: API Gateway
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: api-gateway-hpa
|
|
namespace: foxhunt
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: api-gateway
|
|
minReplicas: 3
|
|
maxReplicas: 10
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 70
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 80
|
|
behavior:
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 300
|
|
policies:
|
|
- type: Percent
|
|
value: 50
|
|
periodSeconds: 60
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 0
|
|
policies:
|
|
- type: Percent
|
|
value: 100
|
|
periodSeconds: 30
|
|
- type: Pods
|
|
value: 2
|
|
periodSeconds: 30
|
|
selectPolicy: Max
|
|
|
|
---
|
|
# HPA: Trading Service
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: trading-service-hpa
|
|
namespace: foxhunt
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: trading-service
|
|
minReplicas: 2
|
|
maxReplicas: 5
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 80
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 85
|
|
behavior:
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 300
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 120
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 0
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 60
|
|
|
|
---
|
|
# HPA: ML Training Service
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: ml-training-service-hpa
|
|
namespace: foxhunt
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: ml-training-service
|
|
minReplicas: 1
|
|
maxReplicas: 3
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: nvidia.com/gpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 90
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: 85
|
|
behavior:
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 600
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 300
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 60
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 120
|