academia/deploy/k3s/api.yaml

87 lines
2.1 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: student-api
namespace: student-enrollment
labels:
app: student-api
spec:
replicas: 2
selector:
matchLabels:
app: student-api
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: student-api
spec:
containers:
- name: api
image: docker.io/library/academia-api:v2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5000
name: http
env:
- name: ASPNETCORE_ENVIRONMENT
valueFrom:
configMapKeyRef:
name: student-config
key: ASPNETCORE_ENVIRONMENT
- name: ASPNETCORE_URLS
valueFrom:
configMapKeyRef:
name: student-config
key: ASPNETCORE_URLS
- name: ConnectionStrings__DefaultConnection
valueFrom:
secretKeyRef:
name: student-secrets
key: db-connection-string
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
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