127 lines
2.9 KiB
YAML
127 lines
2.9 KiB
YAML
# 1. api Deployment — Flask backend
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: api
|
|
namespace: taskapp
|
|
labels:
|
|
app: api
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: api
|
|
spec:
|
|
containers:
|
|
- name: api
|
|
image: taskapp-api:v1
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 5000
|
|
name: http
|
|
env:
|
|
- name: DB_HOST
|
|
value: "db"
|
|
- name: DB_PORT
|
|
value: "5432"
|
|
- name: DB_NAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-credentials
|
|
key: POSTGRES_DB
|
|
- name: DB_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-credentials
|
|
key: POSTGRES_USER
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-credentials
|
|
key: POSTGRES_PASSWORD
|
|
resources:
|
|
requests:
|
|
cpu: 50m
|
|
memory: 64Mi
|
|
limits:
|
|
cpu: 250m
|
|
memory: 256Mi
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/health
|
|
port: 5000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 6
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/health
|
|
port: 5000
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 15
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
|
|
---
|
|
# 2. web Deployment — Nginx frontend
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: web
|
|
namespace: taskapp
|
|
labels:
|
|
app: web
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: web
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: web
|
|
spec:
|
|
containers:
|
|
- name: web
|
|
image: taskapp-web:v1
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 80
|
|
name: http
|
|
volumeMounts:
|
|
- name: nginx-config
|
|
mountPath: /etc/nginx/nginx.conf
|
|
subPath: nginx.conf
|
|
readOnly: true
|
|
resources:
|
|
requests:
|
|
cpu: 25m
|
|
memory: 32Mi
|
|
limits:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 80
|
|
initialDelaySeconds: 1
|
|
periodSeconds: 5
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 80
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 15
|
|
volumes:
|
|
- name: nginx-config
|
|
configMap:
|
|
name: nginx-config
|
|
items:
|
|
- key: nginx.conf
|
|
path: nginx.conf
|