apiVersion: v1 kind: ConfigMap metadata: name: warehouse-allocation data: WA_ENVIRONMENT: production WA_INVENTORY_BACKEND: redis WA_REDIS_URL: redis://redis.inventory.svc.cluster.local:6379/0 WA_MAX_CANDIDATE_WAREHOUSES: "33" --- apiVersion: apps/v1 kind: Deployment metadata: name: warehouse-allocation spec: replicas: 2 selector: matchLabels: app: warehouse-allocation template: metadata: labels: app: warehouse-allocation spec: containers: - name: api image: registry.example.com/warehouse-allocation:1.0.0 ports: - containerPort: 8080 envFrom: - configMapRef: name: warehouse-allocation - secretRef: name: warehouse-allocation-secrets readinessProbe: httpGet: path: /health/ready port: 8080 periodSeconds: 5 livenessProbe: httpGet: path: /health/live port: 8080 periodSeconds: 10 resources: requests: cpu: 100m memory: 128Mi limits: cpu: "1" memory: 512Mi securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true runAsNonRoot: true capabilities: drop: ["ALL"] --- apiVersion: v1 kind: Service metadata: name: warehouse-allocation spec: selector: app: warehouse-allocation ports: - port: 80 targetPort: 8080 --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: warehouse-allocation spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: warehouse-allocation minReplicas: 2 maxReplicas: 20 behavior: scaleDown: stabilizationWindowSeconds: 300 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 65