fix: dodane liveness i readiness probe
Some checks failed
CI/CD Pipeline / build (push) Successful in 1m35s
CI/CD Pipeline / deploy (push) Failing after 56s

This commit is contained in:
2026-05-02 17:54:59 +02:00
parent 9c6daaa6b6
commit 191d498397

View File

@@ -1,55 +1,66 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: hello-cicd name: moj-servis
namespace: student-sz11zs namespace: student-sz11zs
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: hello-cicd app: moj-servis
template: template:
metadata: metadata:
labels: labels:
app: hello-cicd app: moj-servis
spec: spec:
imagePullSecrets: imagePullSecrets:
- name: gitea-creds - name: gitea-creds
containers: containers:
- name: hello-cicd - name: moj-servis
image: git.fpmoz.sum.ba/sz11zs/hello-cicd:latest image: git.fpmoz.sum.ba/sz11zs/moj-servis:1.0
ports: ports:
- containerPort: 8000 - containerPort: 8000
# 1. POVEZIVANJE S CONFIGMAP I SECRET (iz prethodnog koraka) # 1. POVEZIVANJE S OKOLINSKIM VARIJABLAMA (Secret i ConfigMap)
env: env:
- name: APP_VERSION
valueFrom:
configMapKeyRef:
name: hello-cicd-config
key: APP_VERSION
- name: DB_PASSWORD - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: hello-cicd-secret name: moj-servis-secret
key: password key: DB_PASSWORD
- name: API_KEY
valueFrom:
secretKeyRef:
name: moj-servis-secret
key: API_KEY
envFrom:
- configMapRef:
name: moj-servis-config
# 2. LIVENESS PROBE (je li proces živ?) # 2. LIVENESS PROBE: Provjerava je li proces "živ"
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 8000 port: 8000
initialDelaySeconds: 10 # čekaj 10s nakon starta initialDelaySeconds: 10 # Čekaj 10s nakon starta
periodSeconds: 15 # provjeri svakih 15s[cite: 1] periodSeconds: 15 # Provjeravaj svakih 15s
timeoutSeconds: 3 # timeout odgovora[cite: 1] timeoutSeconds: 3 # Max vrijeme za odgovor
failureThreshold: 3 # 3 fail-a => restart[cite: 1] failureThreshold: 3 # 3 neuspjeha zaredom = RESTART[cite: 1]
# 3. READINESS PROBE (prima li promet?)[cite: 1] # 3. READINESS PROBE: Provjerava je li aplikacija spremna primati promet[cite: 1]
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 8000 port: 8000
initialDelaySeconds: 5 initialDelaySeconds: 5 # Čekaj 5s nakon starta[cite: 1]
periodSeconds: 10 periodSeconds: 10 # Provjeravaj svakih 10s[cite: 1]
timeoutSeconds: 2 timeoutSeconds: 2
failureThreshold: 2 failureThreshold: 2 # 2 neuspjeha zaredom = micanje iz prometa[cite: 1]
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "200m"