academia/deploy/k3s/api.yaml

94 lines
2.3 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: student-api
namespace: student-enrollment
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: academia-api:latest
imagePullPolicy: Never
ports:
- containerPort: 5000
name: http
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Production"
- name: 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: "128Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
---
apiVersion: v1
kind: Service
metadata:
name: student-api
namespace: student-enrollment
spec:
selector:
app: student-api
ports:
- port: 5000
targetPort: 5000
name: http
type: ClusterIP