66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: moj-servis
|
|
namespace: student-sz11zs
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: moj-servis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: moj-servis
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: gitea-creds
|
|
containers:
|
|
- name: moj-servis
|
|
image: git.fpmoz.sum.ba/sz11zs/moj-servis:1.0
|
|
ports:
|
|
- containerPort: 8000
|
|
|
|
# 1. POVEZIVANJE S OKOLINSKIM VARIJABLAMA (Secret i ConfigMap)
|
|
env:
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: moj-servis-secret
|
|
key: DB_PASSWORD
|
|
- name: API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: moj-servis-secret
|
|
key: API_KEY
|
|
envFrom:
|
|
- configMapRef:
|
|
name: moj-servis-config
|
|
|
|
# 2. LIVENESS PROBE: Provjerava je li proces "živ"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 10 # Čekaj 10s nakon starta
|
|
periodSeconds: 15 # Provjeravaj svakih 15s
|
|
timeoutSeconds: 3 # Max vrijeme za odgovor
|
|
failureThreshold: 3 # 3 neuspjeha zaredom = RESTART[cite: 1]
|
|
|
|
# 3. READINESS PROBE: Provjerava je li aplikacija spremna primati promet[cite: 1]
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 5 # Čekaj 5s nakon starta[cite: 1]
|
|
periodSeconds: 10 # Provjeravaj svakih 10s[cite: 1]
|
|
timeoutSeconds: 2
|
|
failureThreshold: 2 # 2 neuspjeha zaredom = micanje iz prometa[cite: 1]
|
|
|
|
resources:
|
|
requests:
|
|
memory: "64Mi"
|
|
cpu: "50m"
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "200m" |