45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
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 |