add kubernetes deployment files

This commit is contained in:
2025-07-06 18:56:50 +08:00
parent b4ec264858
commit 89aedbcdad
11 changed files with 635 additions and 11 deletions

View File

@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fastapi-k8s-app.fullname" . }}
labels:
{{- include "fastapi-k8s-app.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "fastapi-k8s-app.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "fastapi-k8s-app.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
# 添加健康检查Liveness/Readiness probes以提高应用的健壮性
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 5
# resource limits
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 50m
# memory: 64Mi