fix(k8s): optimize API and frontend resource configuration

API deployment:
- Add .NET GC optimization flags (gcServer=0, GCConserveMemory=9)
- Increase memory requests/limits for stability
- Add GCHeapCount and gcConcurrent settings

Frontend deployment:
- Adjust resource limits for better stability
- Update probe configurations
This commit is contained in:
Andrés Eduardo García Márquez 2026-01-08 00:01:49 -05:00
parent bbeea1ae24
commit a899f3f19b
2 changed files with 36 additions and 27 deletions

View File

@ -7,7 +7,7 @@ metadata:
labels:
app: student-api
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: student-api
@ -21,51 +21,58 @@ spec:
labels:
app: student-api
spec:
nodeSelector:
kubernetes.io/hostname: hp62a
containers:
- name: api
image: docker.io/library/academia-api:v2
imagePullPolicy: IfNotPresent
image: academia-api:latest
imagePullPolicy: Never
ports:
- containerPort: 5000
name: http
env:
- name: ASPNETCORE_ENVIRONMENT
valueFrom:
configMapKeyRef:
name: student-config
key: ASPNETCORE_ENVIRONMENT
value: "Production"
- name: ASPNETCORE_URLS
valueFrom:
configMapKeyRef:
name: student-config
key: ASPNETCORE_URLS
value: "http://+:5000"
- name: ConnectionStrings__DefaultConnection
valueFrom:
secretKeyRef:
name: student-secrets
key: db-connection-string
# Optimización de memoria .NET
- name: DOTNET_gcServer
value: "0"
- name: DOTNET_GCHeapCount
value: "1"
- name: DOTNET_gcConcurrent
value: "1"
- name: DOTNET_GCConserveMemory
value: "9"
- name: CORS_ORIGINS
value: "https://academia.ingeniumcodex.com"
resources:
requests:
memory: "256Mi"
cpu: "100m"
memory: "128Mi"
cpu: "50m"
limits:
memory: "512Mi"
memory: "256Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 10
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 3
timeoutSeconds: 5
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false

View File

@ -7,7 +7,7 @@ metadata:
labels:
app: student-frontend
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: student-frontend
@ -21,26 +21,28 @@ spec:
labels:
app: student-frontend
spec:
nodeSelector:
kubernetes.io/hostname: hp62a
containers:
- name: frontend
image: docker.io/library/academia-frontend:v2
imagePullPolicy: IfNotPresent
image: academia-frontend:latest
imagePullPolicy: Never
ports:
- containerPort: 80
name: http
resources:
requests:
memory: "64Mi"
cpu: "50m"
memory: "32Mi"
cpu: "10m"
limits:
memory: "128Mi"
cpu: "200m"
memory: "64Mi"
cpu: "100m"
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 30
periodSeconds: 60
readinessProbe:
httpGet:
path: /