From b1316d136352b98b28b327a1faff538f28c3246f Mon Sep 17 00:00:00 2001 From: Marta Bulic Date: Sat, 2 May 2026 15:03:24 +0200 Subject: [PATCH] Add liveness and readiness probes --- k8s/moj-servis/deployment.yaml | 58 +++++++++++++++------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/k8s/moj-servis/deployment.yaml b/k8s/moj-servis/deployment.yaml index df855c2..2c9b998 100644 --- a/k8s/moj-servis/deployment.yaml +++ b/k8s/moj-servis/deployment.yaml @@ -1,41 +1,33 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: moj-servis - namespace: student-martabulic spec: - replicas: 1 - selector: - matchLabels: - app: moj-servis template: - metadata: - labels: - app: moj-servis spec: containers: - name: moj-servis - image: git.fpmoz.sum.ba/martabulic/moj-servis:1.0 + image: git.fpmoz.sum.ba/MartaBulic/moj-servis:1.0 ports: - containerPort: 8000 - envFrom: # <-- NOVO - - configMapRef: - name: moj-servis-config # <-- ConfigMap - env: # <-- NOVO - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: moj-servis-secret # <-- Secret - key: DB_PASSWORD - - name: API_KEY - valueFrom: - secretKeyRef: - name: moj-servis-secret - key: API_KEY + + # ── Liveness: je li proces živ? ───────────────── + livenessProbe: + httpGet: + path: /health + port: 8000 + initialDelaySeconds: 10 # čekaj 10s nakon starta + periodSeconds: 15 # provjeri svakih 15s + timeoutSeconds: 3 # timeout odgovora + failureThreshold: 3 # 3 fail-a => restart + + # ── Readiness: prima li promet? ───────────────── + readinessProbe: + httpGet: + path: /health + port: 8000 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 2 + resources: - requests: - memory: "64Mi" - cpu: "50m" - limits: - memory: "128Mi" - cpu: "200m" + requests: { memory: "64Mi", cpu: "50m" } + limits: { memory: "128Mi", cpu: "200m" } +## \ No newline at end of file