Actualiser z2/deployment.yaml

This commit is contained in:
Antonin Filippi 2025-04-23 07:35:26 +00:00
parent 2398735bcb
commit 08b902f8fe

View File

@ -1,50 +1,49 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: web name: web
namespace: my-app namespace: my-app
spec: spec:
replicas: 2 replicas: 2
selector: selector:
matchLabels: matchLabels:
app: web app: web
template: template:
metadata: metadata:
labels: labels:
app: web app: web
spec: spec:
initContainers: initContainers:
- name: wait-for-postgres - name: wait-for-postgres
image: busybox image: busybox
command: command:
- sh - sh
- -c - -c
- | - |
until nc -z postgres 5432; do until nc -z postgres 5432; do
echo "Waiting for PostgreSQL..." echo "Waiting for PostgreSQL..."
sleep 2 sleep 2
done done
containers: containers:
- name: web - name: web
# use the LOCAL image you just built, not the one on Docker Hub image: simple-web-app:latest
image: simple-web-app:latest imagePullPolicy: IfNotPresent
imagePullPolicy: IfNotPresent ports:
ports: - containerPort: 5000
- containerPort: 5000 env:
env: - name: DB_HOST
- name: DB_HOST value: postgres
value: postgres - name: DB_PORT
- name: DB_PORT value: "5432"
value: "5432" - name: DB_NAME
- name: DB_NAME value: postgres
value: postgres - name: DB_USER
- name: DB_USER value: postgres
value: postgres - name: DB_PASS
- name: DB_PASS value: postgres
value: postgres readinessProbe:
readinessProbe: httpGet:
httpGet: path: /
path: / port: 5000
port: 5000 initialDelaySeconds: 15
initialDelaySeconds: 15 periodSeconds: 10
periodSeconds: 10