1e04655003
- 三个 app 的 5 个独立 yaml 合成单文件 all.yaml,多 doc 内显式排序,apply 不再受目录字母序影响(这是 piano-sheet run #49 NotFound 的根因) - simpleasm/cube workflow 补 Initialize K8s resources 步骤,跟 piano-sheet 对齐;今后 manifest 改动 CI 自动 apply - cube 的 _registry-ingress.yaml 不再需要前缀绕排序,去掉 _
122 lines
2.7 KiB
YAML
122 lines
2.7 KiB
YAML
apiVersion: v1
|
||
kind: Namespace
|
||
metadata:
|
||
name: cube-piano
|
||
---
|
||
apiVersion: v1
|
||
kind: PersistentVolumeClaim
|
||
metadata:
|
||
name: piano-sheet-data
|
||
namespace: cube-piano
|
||
spec:
|
||
accessModes:
|
||
- ReadWriteOnce
|
||
resources:
|
||
requests:
|
||
# 图片直存 sqlite,留出宽裕空间
|
||
storage: 10Gi
|
||
# storageClassName 留空 → 走 k3s 默认 local-path(hostPath,单节点足够)
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: piano-sheet
|
||
namespace: cube-piano
|
||
labels:
|
||
app: piano-sheet
|
||
spec:
|
||
replicas: 1
|
||
strategy:
|
||
# PVC 是 RWO,rolling 上线时新旧 pod 抢 PVC 会卡住,直接 Recreate
|
||
type: Recreate
|
||
selector:
|
||
matchLabels:
|
||
app: piano-sheet
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: piano-sheet
|
||
spec:
|
||
imagePullSecrets:
|
||
- name: registry-creds
|
||
containers:
|
||
- name: piano-sheet
|
||
image: registry.famzheng.me/mochi/piano-sheet:latest
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- containerPort: 8080
|
||
name: http
|
||
env:
|
||
- name: DB_PATH
|
||
value: /data/app.db
|
||
readinessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: http
|
||
initialDelaySeconds: 1
|
||
periodSeconds: 5
|
||
livenessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: http
|
||
initialDelaySeconds: 5
|
||
periodSeconds: 15
|
||
resources:
|
||
requests:
|
||
cpu: 10m
|
||
memory: 32Mi
|
||
limits:
|
||
cpu: 500m
|
||
memory: 256Mi
|
||
volumeMounts:
|
||
- name: data
|
||
mountPath: /data
|
||
volumes:
|
||
- name: data
|
||
persistentVolumeClaim:
|
||
claimName: piano-sheet-data
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: piano-sheet
|
||
namespace: cube-piano
|
||
spec:
|
||
selector:
|
||
app: piano-sheet
|
||
ports:
|
||
- name: http
|
||
port: 80
|
||
targetPort: 8080
|
||
---
|
||
apiVersion: traefik.io/v1alpha1
|
||
kind: Middleware
|
||
metadata:
|
||
name: bodylimit
|
||
namespace: cube-piano
|
||
spec:
|
||
buffering:
|
||
maxRequestBodyBytes: 700000000
|
||
---
|
||
apiVersion: networking.k8s.io/v1
|
||
kind: Ingress
|
||
metadata:
|
||
name: piano-sheet
|
||
namespace: cube-piano
|
||
annotations:
|
||
# 上传整组图片可能 ~600MB,调高 traefik 默认上限
|
||
traefik.ingress.kubernetes.io/router.middlewares: cube-piano-bodylimit@kubernetescrd
|
||
spec:
|
||
ingressClassName: traefik
|
||
rules:
|
||
- host: piano.famzheng.me
|
||
http:
|
||
paths:
|
||
- path: /
|
||
pathType: Prefix
|
||
backend:
|
||
service:
|
||
name: piano-sheet
|
||
port:
|
||
number: 80
|