academia/deploy/k3s/api.yaml

94 lines
2.3 KiB
YAML
Raw Normal View History

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: student-api
namespace: academia
labels:
app: student-api
spec:
replicas: 1
selector:
matchLabels:
app: student-api
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: student-api
spec:
nodeSelector:
kubernetes.io/hostname: hp62a
containers:
- name: api
image: student-api:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
name: http
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Production"
- name: ASPNETCORE_URLS
value: "http://+:8080"
- 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: "128Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
---
apiVersion: v1
kind: Service
metadata:
name: student-api
namespace: academia
spec:
selector:
app: student-api
ports:
- port: 8080
targetPort: 8080
name: http
type: ClusterIP