apiVersion: apps/v1 kind: Deployment metadata: name: job-info-backend namespace: job-info labels: app: job-info component: backend version: v1 spec: replicas: 2 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: job-info component: backend template: metadata: labels: app: job-info component: backend version: v1 spec: serviceAccountName: job-info-backend containers: - name: backend image: job-info-backend:latest imagePullPolicy: Always ports: - name: http containerPort: 3005 protocol: TCP env: - name: NODE_ENV value: "production" - name: PORT value: "3005" - name: LOG_LEVEL value: "info" - name: OAUTH_CLIENT_ID valueFrom: secretKeyRef: name: oauth-credentials key: client-id - name: OAUTH_CLIENT_SECRET valueFrom: secretKeyRef: name: oauth-credentials key: client-secret - name: OAUTH_REDIRECT_URI valueFrom: configMapKeyRef: name: backend-config key: oauth-redirect-uri - name: CORS_ORIGIN valueFrom: configMapKeyRef: name: backend-config key: cors-origin resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi livenessProbe: httpGet: path: /health port: http initialDelaySeconds: 10 periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /health port: http initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 2 securityContext: runAsNonRoot: true runAsUser: 1000 allowPrivilegeEscalation: false readOnlyRootFilesystem: false capabilities: drop: - ALL nodeSelector: kubernetes.io/os: linux affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - job-info topologyKey: kubernetes.io/hostname --- apiVersion: v1 kind: Service metadata: name: job-info-backend namespace: job-info labels: app: job-info component: backend spec: type: ClusterIP ports: - name: http port: 3005 targetPort: http protocol: TCP selector: app: job-info component: backend --- apiVersion: v1 kind: ServiceAccount metadata: name: job-info-backend namespace: job-info labels: app: job-info component: backend --- apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: job-info-backend namespace: job-info spec: minAvailable: 1 selector: matchLabels: app: job-info component: backend --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: job-info-backend namespace: job-info spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: job-info-backend minReplicas: 2 maxReplicas: 5 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 - type: Resource resource: name: memory target: type: Utilization averageUtilization: 80