apiVersion: v1 kind: Namespace metadata: name: opendistillery labels: app: opendistillery environment: production --- apiVersion: v1 kind: ConfigMap metadata: name: opendistillery-config namespace: opendistillery data: API_WORKERS: "8" LOG_LEVEL: "info" ENVIRONMENT: "production" REDIS_URL: "redis://redis-service:6379" POSTGRES_URL: "postgresql://user:password@postgres-service:5432/opendistillery" --- apiVersion: apps/v1 kind: Deployment metadata: name: opendistillery-api namespace: opendistillery spec: replicas: 3 selector: matchLabels: app: opendistillery-api template: metadata: labels: app: opendistillery-api spec: containers: - name: api image: opendistillery/api:latest ports: - containerPort: 8000 env: - name: OPENAI_API_KEY valueFrom: secretKeyRef: name: api-keys key: openai - name: ANTHROPIC_API_KEY valueFrom: secretKeyRef: name: api-keys key: anthropic envFrom: - configMapRef: name: opendistillery-config resources: requests: memory: "1Gi" cpu: "500m" limits: memory: "2Gi" cpu: "1000m" livenessProbe: httpGet: path: /v2/system/health port: 8000 initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: /v2/system/health port: 8000 initialDelaySeconds: 5 periodSeconds: 5 --- apiVersion: v1 kind: Service metadata: name: opendistillery-api-service namespace: opendistillery spec: selector: app: opendistillery-api ports: - protocol: TCP port: 80 targetPort: 8000 type: LoadBalancer --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: opendistillery-api-hpa namespace: opendistillery spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: opendistillery-api minReplicas: 3 maxReplicas: 20 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 - type: Resource resource: name: memory target: type: Utilization averageUtilization: 80