Private
Public Access
1
0

better deploy
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
Sebastian Unterschütz
2025-11-27 19:42:08 +01:00
parent df9c3e4b76
commit 0412168c4e
11 changed files with 322 additions and 117 deletions

View File

@@ -31,12 +31,30 @@ spec:
ports:
- containerPort: 8080
env:
# Kubernetes DNS: "service-name:port"
# Da wir im selben Namespace sind, reicht "redis:6379"
- name: REDIS_ADDR
value: "redis:6379"
# Admin Zugangsdaten (werden von CI injected oder hier fest)
- name: ADMIN_USER
value: "${ADMIN_USER}"
- name: ADMIN_PASS
value: "${ADMIN_PASS}"
value: "${ADMIN_PASS}"
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 10

24
k8s/hpa.yaml Normal file
View File

@@ -0,0 +1,24 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: escape-game-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: escape-game
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80

View File

@@ -38,8 +38,7 @@ spec:
initContainers:
- name: fix-permissions
image: busybox
# Ändert den Besitzer von /data auf User 999 (redis) und Gruppe 999
command: [ "sh", "-c", "chown -R 999:999 /data" ]
command: ["sh", "-c", "chown -R 999:999 /data"]
volumeMounts:
- name: data
mountPath: /data
@@ -51,6 +50,25 @@ spec:
volumeMounts:
- name: data
mountPath: /data
resources:
requests:
memory: "64Mi"
cpu: "50m" # 0.05 CPU Cores
limits:
memory: "256Mi"
cpu: "1000m" # 0.5 CPU Cores
livenessProbe:
exec:
command: ["redis-cli", "ping"]
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
exec:
command: ["redis-cli", "ping"]
initialDelaySeconds: 5
periodSeconds: 10
volumes:
- name: data
persistentVolumeClaim: