Files
manifesti/k8s/moj-servis/deployment.yaml

75 lines
2.0 KiB
YAML

# k8s/moj-servis/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: moj-servis
namespace: student-mirko416
spec:
replicas: 1
selector:
matchLabels:
app: moj-servis
template:
metadata:
labels:
app: moj-servis
spec:
containers:
- name: moj-servis
image: git.fpmoz.sum.ba/mirko416/moj-servis:2.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
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "200m"
spec:
template:
spec:
containers:
- name: moj-servis
image: git.fpmoz.sum.ba/mirko416/moj-servis:2.0
ports:
- containerPort: 8000
# ── 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" }