apiVersion: apps/v1 kind: Deployment metadata: name: math-exercises-app labels: app: math-exercises spec: replicas: 2 selector: matchLabels: app: math-exercises template: metadata: labels: app: math-exercises spec: # Security context for the pod securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 2000 seccompProfile: type: RuntimeDefault containers: - name: math-exercises image: math-exercises:latest ports: - containerPort: 8000 # Security context for the container securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 capabilities: drop: - ALL # Resource limits and requests resources: requests: memory: "64Mi" cpu: "250m" limits: memory: "128Mi" cpu: "500m" # Liveness probe livenessProbe: httpGet: path: /health port: 8000 initialDelaySeconds: 90 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 # Readiness probe readinessProbe: httpGet: path: /health port: 8000 initialDelaySeconds: 2 periodSeconds: 3 timeoutSeconds: 3 failureThreshold: 3 # Environment variables from ConfigMap envFrom: - configMapRef: name: math-exercises-config # Volume mount for temporary files volumeMounts: - name: tmp-volume mountPath: /tmp volumes: - name: tmp-volume emptyDir: {}