From bbeea1ae247c4fdb4eee73b3614c54f969c882f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Eduardo=20Garc=C3=ADa=20M=C3=A1rquez?= Date: Thu, 8 Jan 2026 00:01:39 -0500 Subject: [PATCH] fix(k8s): increase SQL Server memory to prevent OOMKilled - Increase memory limit from 1Gi to 1.5Gi - Increase MSSQL_MEMORY_LIMIT_MB from 768 to 1024 - Increase liveness probe initialDelaySeconds to 120 - Increase failureThreshold to 5 for more tolerance - Increase readiness probe timeouts Fixes DEF-001: SQL Server was crashing with Exit Code 137 (OOMKilled) due to insufficient memory allocation for SQL Server 2022 Express. --- deploy/k3s/sqlserver.yaml | 42 +++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/deploy/k3s/sqlserver.yaml b/deploy/k3s/sqlserver.yaml index 1641bbd..00765ec 100644 --- a/deploy/k3s/sqlserver.yaml +++ b/deploy/k3s/sqlserver.yaml @@ -10,7 +10,7 @@ spec: storageClassName: local-path resources: requests: - storage: 5Gi + storage: 2Gi --- apiVersion: apps/v1 kind: Deployment @@ -31,6 +31,8 @@ spec: labels: app: sqlserver spec: + nodeSelector: + kubernetes.io/hostname: hp62a containers: - name: sqlserver image: mcr.microsoft.com/mssql/server:2022-latest @@ -45,26 +47,46 @@ spec: secretKeyRef: name: student-secrets key: db-password + # SQL Server Express - Optimización RAM + - name: MSSQL_PID + value: "Express" + - name: MSSQL_MEMORY_LIMIT_MB + value: "1024" + - name: MSSQL_AGENT_ENABLED + value: "false" volumeMounts: - name: sqlserver-data mountPath: /var/opt/mssql resources: requests: - memory: "1Gi" - cpu: "500m" + memory: "1.2Gi" + cpu: "250m" limits: - memory: "2Gi" + memory: "1.5Gi" cpu: "1000m" livenessProbe: - tcpSocket: - port: 1433 - initialDelaySeconds: 30 - periodSeconds: 10 + exec: + command: + - /opt/mssql-tools18/bin/sqlcmd + - -S + - localhost + - -U + - sa + - -P + - $(MSSQL_SA_PASSWORD) + - -Q + - SELECT 1 + - -C + initialDelaySeconds: 120 + periodSeconds: 60 + timeoutSeconds: 15 + failureThreshold: 5 readinessProbe: tcpSocket: port: 1433 - initialDelaySeconds: 30 - periodSeconds: 5 + initialDelaySeconds: 60 + periodSeconds: 15 + timeoutSeconds: 10 volumes: - name: sqlserver-data persistentVolumeClaim: