90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: prod-pod
|
|
labels:
|
|
app: inventory-api
|
|
spec:
|
|
replicas: 1 # Reduced replicas to 1 to ensure easier scheduling
|
|
selector:
|
|
matchLabels:
|
|
app: inventory-api
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 0
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: inventory-api
|
|
spec:
|
|
containers:
|
|
- name: app
|
|
image: ${IMAGE_REPOSITORY}:${IMAGE_TAG}
|
|
imagePullPolicy: IfNotPresent # Changed from Always to IfNotPresent to reduce pull issues
|
|
resources:
|
|
requests:
|
|
cpu: "50m" # Reduced CPU request
|
|
memory: "128Mi" # Reduced memory request
|
|
limits:
|
|
cpu: "300m" # Reduced CPU limit
|
|
memory: "384Mi" # Reduced memory limit
|
|
ports:
|
|
- containerPort: 8000
|
|
name: http
|
|
env:
|
|
- name: SECRET_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: inventory-api-secrets
|
|
key: secret-key
|
|
- name: SERVER_NAME
|
|
value: "Inventory Management System"
|
|
- name: SERVER_HOST
|
|
value: "https://inventory.example.com"
|
|
- name: FIRST_SUPERUSER
|
|
value: "admin@example.com"
|
|
- name: FIRST_SUPERUSER_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: inventory-api-secrets
|
|
key: admin-password
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
volumeMounts:
|
|
- name: storage-volume
|
|
mountPath: /app/storage
|
|
volumes:
|
|
- name: storage-volume
|
|
persistentVolumeClaim:
|
|
claimName: inventory-api-pvc
|
|
# Enhanced tolerations to allow more flexible scheduling
|
|
tolerations:
|
|
- operator: "Exists" # This will tolerate all taints
|
|
# Affinity settings to help with scheduling
|
|
affinity:
|
|
nodeAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 1
|
|
preference:
|
|
matchExpressions:
|
|
- key: "kubernetes.io/os"
|
|
operator: In
|
|
values:
|
|
- linux
|
|
# No nodeSelector to allow maximum scheduling flexibility |