Files
ewoooc/k8s/optimized/04-momo-app-optimized.yaml
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

126 lines
3.0 KiB
YAML

# =============================================================================
# WOOO TECH - Momo Pro System
# 優化版 momo-app Deployment
# 優化重點: 資源配置、健康檢查、滾動更新策略
# =============================================================================
apiVersion: apps/v1
kind: Deployment
metadata:
name: momo-app
namespace: momo
spec:
replicas: 1
# 滾動更新策略 - 確保零停機
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app: momo-app
template:
metadata:
labels:
app: momo-app
spec:
# 優雅終止時間
terminationGracePeriodSeconds: 30
# Init Container - 複製 Google Drive 認證
initContainers:
- name: copy-google-credentials
image: busybox:1.36
command: ['sh', '-c', 'cp /secrets/* /config/ && chmod 644 /config/*']
volumeMounts:
- name: google-drive-secrets
mountPath: /secrets
readOnly: true
- name: momo-config-volume
mountPath: /config
containers:
- name: momo-app
image: momo-pro-system:local
imagePullPolicy: Never
ports:
- containerPort: 80
# 環境變數
envFrom:
- configMapRef:
name: momo-config
- secretRef:
name: momo-secrets
# 資源配置 (平衡穩定性與效能)
resources:
requests:
memory: 512Mi
cpu: 200m
limits:
memory: 2Gi
cpu: 1000m
# 存活探測 - 確保應用正常運行
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
successThreshold: 1
# 就緒探測 - 確保可接收流量
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
# 啟動探測 - 給予更多啟動時間
startupProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 30 # 5*30=150秒啟動時間
successThreshold: 1
volumeMounts:
- name: momo-data
mountPath: /app/data
- name: momo-config-volume
mountPath: /app/config
volumes:
- name: momo-data
persistentVolumeClaim:
claimName: momo-data-pvc
- name: google-drive-secrets
secret:
secretName: google-drive-credentials
- name: momo-config-volume
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: momo-app
namespace: momo
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
app: momo-app