根因:后端容器内存 limit 仅 768Mi,ffmpeg 编码 1080P 竖屏时内存峰值超限被 K8s OOMKill,导出后台线程随 Pod 重启而死,任务永远停在 35%(本地无 limit 29s 出片)。 - k8s/core/api-deployment.yaml: 后端内存 limit 768Mi→2Gi、requests 256→512Mi, 给 ffmpeg 足够编码空间(根治) - export.py: ffmpeg subprocess 加 900s 超时(卡死不再永久 RUNNING)+ -threads 2 降内存峰值 - views.py: submit-export 清理超 5 分钟未结束的僵尸任务,前端不再无限转圈 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: airshelf-core-api
|
|
labels:
|
|
app: airshelf-core-api
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: airshelf-core-api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: airshelf-core-api
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: cr-pull-secret
|
|
containers:
|
|
- name: airshelf-core-api
|
|
image: ${CI_REGISTRY_IMAGE}/airshelf-core-api:latest
|
|
imagePullPolicy: Always
|
|
# No command override: the image ENTRYPOINT (docker-entrypoint.sh) runs
|
|
# migrate + collectstatic, then the default CMD (gunicorn) is exec'd.
|
|
ports:
|
|
- containerPort: 8000
|
|
envFrom:
|
|
- secretRef:
|
|
name: airshelf-core-env
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/health/
|
|
port: 8000
|
|
httpHeaders:
|
|
- name: Host
|
|
value: airshelf-web.airlabs.art
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 15
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/health/
|
|
port: 8000
|
|
httpHeaders:
|
|
- name: Host
|
|
value: airshelf-web.airlabs.art
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
# 视频导出在本容器后台线程跑 ffmpeg,编码 1080P 竖屏 + 多路输入 + 字幕/配音混音
|
|
# 内存峰值可达 1.5GB,原 768Mi 必被 OOMKill(导出卡 35%、Pod 重启)。提到 2Gi 给足空间。
|
|
memory: "2Gi"
|
|
cpu: "1500m"
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: airshelf-core-api
|
|
spec:
|
|
selector:
|
|
app: airshelf-core-api
|
|
ports:
|
|
- protocol: TCP
|
|
port: 8000
|
|
targetPort: 8000
|