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:
parent
bbeea1ae24
commit
a899f3f19b
|
|
@ -7,7 +7,7 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
app: student-api
|
app: student-api
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: student-api
|
app: student-api
|
||||||
|
|
@ -21,51 +21,58 @@ spec:
|
||||||
labels:
|
labels:
|
||||||
app: student-api
|
app: student-api
|
||||||
spec:
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: hp62a
|
||||||
containers:
|
containers:
|
||||||
- name: api
|
- name: api
|
||||||
image: docker.io/library/academia-api:v2
|
image: academia-api:latest
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: Never
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5000
|
- containerPort: 5000
|
||||||
name: http
|
name: http
|
||||||
env:
|
env:
|
||||||
- name: ASPNETCORE_ENVIRONMENT
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
valueFrom:
|
value: "Production"
|
||||||
configMapKeyRef:
|
|
||||||
name: student-config
|
|
||||||
key: ASPNETCORE_ENVIRONMENT
|
|
||||||
- name: ASPNETCORE_URLS
|
- name: ASPNETCORE_URLS
|
||||||
valueFrom:
|
value: "http://+:5000"
|
||||||
configMapKeyRef:
|
|
||||||
name: student-config
|
|
||||||
key: ASPNETCORE_URLS
|
|
||||||
- name: ConnectionStrings__DefaultConnection
|
- name: ConnectionStrings__DefaultConnection
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: student-secrets
|
name: student-secrets
|
||||||
key: db-connection-string
|
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:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: "256Mi"
|
memory: "128Mi"
|
||||||
cpu: "100m"
|
cpu: "50m"
|
||||||
limits:
|
limits:
|
||||||
memory: "512Mi"
|
memory: "256Mi"
|
||||||
cpu: "500m"
|
cpu: "500m"
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
port: 5000
|
port: 5000
|
||||||
initialDelaySeconds: 15
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 20
|
periodSeconds: 30
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 10
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
port: 5000
|
port: 5000
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 15
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 3
|
timeoutSeconds: 5
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
securityContext:
|
securityContext:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
app: student-frontend
|
app: student-frontend
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: student-frontend
|
app: student-frontend
|
||||||
|
|
@ -21,26 +21,28 @@ spec:
|
||||||
labels:
|
labels:
|
||||||
app: student-frontend
|
app: student-frontend
|
||||||
spec:
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: hp62a
|
||||||
containers:
|
containers:
|
||||||
- name: frontend
|
- name: frontend
|
||||||
image: docker.io/library/academia-frontend:v2
|
image: academia-frontend:latest
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: Never
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
name: http
|
name: http
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: "64Mi"
|
memory: "32Mi"
|
||||||
cpu: "50m"
|
cpu: "10m"
|
||||||
limits:
|
limits:
|
||||||
memory: "128Mi"
|
memory: "64Mi"
|
||||||
cpu: "200m"
|
cpu: "100m"
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
port: 80
|
port: 80
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
periodSeconds: 30
|
periodSeconds: 60
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue