76 lines
1.6 KiB
YAML
76 lines
1.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: fastapi-app-deployment
|
|
spec:
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app: fastapi-app
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: fastapi-app
|
|
spec:
|
|
containers:
|
|
- name: fastapi-app-container
|
|
image: igit.danilkolesnikov.ru/danil/playground_app
|
|
ports:
|
|
- name: web
|
|
containerPort: 8000
|
|
readinessProbe:
|
|
exec:
|
|
command: ["alembic", "check"]
|
|
timeoutSeconds: 5
|
|
periodSeconds: 5
|
|
env:
|
|
- name: DATABASE_URL
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-secrets
|
|
key: url
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: fastapi-app-db-migration
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: fastapi-app-db-migration
|
|
image: igit.danilkolesnikov.ru/danil/playground_app
|
|
command: ["alembic", "upgrade", "head"]
|
|
env:
|
|
- name: DATABASE_URL
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-secrets
|
|
key: url
|
|
restartPolicy: OnFailure
|
|
backoffLimit: 5
|
|
ttlSecondsAfterFinished: 1
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: fastapi-app-service
|
|
spec:
|
|
selector:
|
|
app: fastapi-app
|
|
ports:
|
|
- protocol: TCP
|
|
port: 8000
|
|
targetPort: 8000
|
|
---
|
|
apiVersion: monitoring.coreos.com/v1
|
|
kind: PodMonitor
|
|
metadata:
|
|
name: fastapi-app-pod-monitor
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: fastapi-app
|
|
podMetricsEndpoints:
|
|
- port: web
|