apiVersion: apps/v1 kind: Deployment metadata: name: intake-service namespace: the-order labels: app: intake-service version: v1 spec: replicas: 2 selector: matchLabels: app: intake-service template: metadata: labels: app: intake-service version: v1 spec: containers: - name: intake image: theorder/intake-service:latest ports: - containerPort: 4001 name: http env: - name: PORT value: "4001" - name: NODE_ENV valueFrom: configMapKeyRef: name: the-order-config key: ENVIRONMENT - name: DATABASE_URL valueFrom: secretKeyRef: name: the-order-secrets key: database-url - name: STORAGE_BUCKET valueFrom: secretKeyRef: name: the-order-secrets key: storage-bucket resources: requests: memory: "256Mi" cpu: "100m" limits: memory: "512Mi" cpu: "500m" livenessProbe: httpGet: path: /health port: 4001 initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /health port: 4001 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 startupProbe: httpGet: path: /health port: 4001 initialDelaySeconds: 0 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 30 lifecycle: preStop: exec: command: ["/bin/sh", "-c", "sleep 15"] --- apiVersion: v1 kind: Service metadata: name: intake-service namespace: the-order spec: selector: app: intake-service ports: - port: 80 targetPort: 4001 protocol: TCP type: ClusterIP --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: intake-service-hpa namespace: the-order spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: intake-service minReplicas: 2 maxReplicas: 10 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 - type: Resource resource: name: memory target: type: Utilization averageUtilization: 80