dodani Kubernetes manifesti za FastAPI i Postgres

This commit is contained in:
2026-05-25 19:34:51 +02:00
commit bd0dc46938
9 changed files with 167 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: student-antoniomaric1
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgres-secret
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
readinessProbe:
exec:
command: ["pg_isready", "-U", "fastapiuser", "-d", "fastapidb"]
initialDelaySeconds: 10
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgres-pvc

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
namespace: student-antoniomaric1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: local-path

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: postgres-service
namespace: student-antoniomaric1
spec:
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
type: ClusterIP