基础设施 · K8s GPU 单私有化集群完整案例
定位:中等企业样板的端到端纸面跟读——单套私有化 GPU 集群从节点规划 → GPU Operator → vLLM → Harbor/GitLab/Argo CD → 207 LiteLLM 切流。
边界:本环境(207 / 116)资源不够,不在此教程真装 K8s / Operator / Harbor / GitLab / Argo CD;YAML 与命令仅供实验集群跟读。
对照现状:应用仍在
192.168.110.207(Dify + LiteLLM Compose/systemd);GPU 现状是116.62.10.183Docker vLLM;本案例把 GPU 侧演进到 K8s 池,LiteLLM 只改 upstream。姊妹篇(理论):K8s GPU · Operator · Harbor/GitLab/Argo CD · Argo CD 原理与部署教程
实战对照:作业17 GPU/K8s 与模型路由 · 路由发布 Runbook · LiteLLM 高级功能
清单目录:
patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/HTML:
docs/html_cursor/基础设施_K8s_GPU_单私有化集群完整案例/基础设施_K8s_GPU_单私有化集群完整案例_cursor.html
目录
- 案例目标与边界
- 拓扑与网络规划
- 集群就绪验收
- GPU Operator 安装与验收
- 推理工作负载(vLLM)
- Harbor · GitLab · Argo CD
- 对上现网:207 LiteLLM 切流
- 配额、限流与值班清单
- 故障树
- 验收总表与文件清单
- 完整配置附录
1. 案例目标与边界
1.1 你要带走什么
读完并能在实验集群跟读后,应能说清并演练:
| # | 能力 |
|---|---|
| 1 | 画出「单私有化 GPU 集群」节点角色与污点/标签 |
| 2 | 用 Operator 把 nvidia.com/gpu 变成可调度资源并验收 |
| 3 | 用 GitOps 发两个推理 Deployment(主模型 + 小模型) |
| 4 | 在 不动 Dify 的前提下,改 207 LiteLLM 把流量切到集群,并能回滚到 116 |
1.2 案例约定拓扑(中等企业样板)
| 角色 | 数量 | 规格约定(纸面) | 说明 |
|---|---|---|---|
| Control Plane | 3 | 无 GPU,8C/32G | HA kubeadm / 等价托管控制面 |
| GPU Worker | 6 | 每节点 2× L40S(示意) | 专跑推理;污点 NoSchedule |
| 可调度 GPU 合计 | 12 | nvidia.com/gpu | 配额先锁 gpu-infer≤8 张,留缓冲 |
| 镜像仓 | 1 | Harbor harbor.example.local | 可与集群同机房或旁路 |
| 代码仓 | 1 | GitLab gitlab.example.local | 存 manifests |
| GitOps | 1 | Argo CD(可装在本集群或管理集群) | 本案例装在本集群 argocd NS |
| 应用/网关 | 现状 | 207 Dify + LiteLLM | 不迁入本集群 |
flowchart LR
subgraph APP["现网应用面 · 207"]
DIFY[Dify :80]
LITELLM[LiteLLM :4000]
DIFY --> LITELLM
end
subgraph NOW["现状 GPU · 116"]
DOCKER[Docker vLLM :8000]
end
subgraph CASE["本案例 · 单私有化 GPU 集群"]
ARGO[Argo CD]
OP[GPU Operator]
VLLM1[vllm-qwen36-27b ×2]
VLLM2[vllm-qwen-small ×1]
ING[Ingress]
ARGO --> VLLM1
ARGO --> VLLM2
OP -.->|nvidia.com/gpu| VLLM1
OP -.-> VLLM2
VLLM1 --> ING
VLLM2 --> ING
end
LITELLM -->|切流后主上游| ING
LITELLM -.->|回滚/备上游| DOCKER
GL[GitLab] --> ARGO
HB[Harbor] --> VLLM11.3 明确不做
- 不在 207/116 上安装 K8s
- 不把 Dify / Langfuse / Weaviate 迁进集群(那是另一本迁移手册)
- 不写公网多厂商采购谈判(见理论篇第 5 节)
- 不保证某厂商卡型数值;文中 L40S 仅作「中等企业双卡节点」示意,换成 H20/A100 时改标签与显存请求即可
2. 拓扑与网络规划
2.1 命名与网段(占位)
| 项 | 案例值 |
|---|---|
| 集群名 | gpu-k8s-prod-01 |
| API Server | https://k8s-api.gpu-k8s.example.local:6443 |
| 推理 Ingress | *.gpu-k8s.example.local |
| 模型存储 | NFS / 并行文件系统 StorageClass:nfs-models |
| Pod CIDR / Service CIDR | 按机房规范;需与 207 路由可达 |
关键点:207 上的 LiteLLM 必须能解析并访问 vllm-qwen.gpu-k8s.example.local(内网 DNS 或 /etc/hosts 演练),否则切流必失败。
2.2 命名空间
完整文件:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/01-namespaces.yaml
| Namespace | 用途 |
|---|---|
gpu-operator | Operator 及 DaemonSet |
gpu-infer | 全部推理 Deployment / Service / Ingress |
argocd | Argo CD(若装在本集群) |
2.3 节点标签与污点
在每台 GPU Worker 上约定:
# 纸面命令 —— 在实验集群执行,勿对 116 乱打 taint
kubectl label node gpu-w01 nvidia.com/gpu.present=true --overwrite
kubectl label node gpu-w01 nvidia.com/gpu.product=NVIDIA-L40S --overwrite
kubectl taint nodes gpu-w01 nvidia.com/gpu=true:NoSchedule| 机制 | 作用 |
|---|---|
nvidia.com/gpu.present=true | Deployment nodeSelector 只落 GPU 节点 |
nvidia.com/gpu=true:NoSchedule | 无 toleration 的普通 Pod 上不来 |
| GFD(Operator) | 自动补卡型等标签,亲和性更好写 |
配额与备注 ConfigMap:02-quota-and-node-notes.yaml。
3. 集群就绪验收
控制面与 CNI 就绪后再装 Operator。最低检查:
kubectl get nodes -o wide
# 期望:3× control-plane Ready;6× worker Ready
kubectl get pods -A | grep -E 'calico|cilium|flannel|kube-system'
# CNI / dns 无 CrashLoop
kubectl get cs # 老版本;新版本看 component status 等价检查验收口诀:节点 Ready → CoreDNS 正常 → 任意非 GPU Pod 能调度成功 → 再进入第 4 节。
4. GPU Operator 安装与验收
理论背景见姊妹篇「§3 NVIDIA GPU Operator」。本案例用 Helm values 片段:
patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/07-gpu-operator-values.yaml
# 纸面 —— 版本号以 NVIDIA 文档稳定版为准
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
helm upgrade --install gpu-operator nvidia/gpu-operator \
-n gpu-operator --create-namespace \
-f patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/07-gpu-operator-values.yaml4.1 组件就绪
kubectl get pods -n gpu-operator
# 期望各节点:driver(若启用)/ toolkit / device-plugin / gfd / dcgm-exporter Running
kubectl describe node gpu-w01 | findstr /C:"nvidia.com/gpu"
# Linux: kubectl describe node gpu-w01 | grep -A8 Capacity期望 Capacity / Allocatable 出现类似:
nvidia.com/gpu: 2(每 Worker 2 卡 → 全集群 Allocatable 合计 12。)
4.2 冒烟:占 1 卡的 Job
apiVersion: batch/v1
kind: Job
metadata:
name: gpu-smoke
namespace: gpu-infer
spec:
template:
spec:
restartPolicy: Never
nodeSelector:
nvidia.com/gpu.present: "true"
tolerations:
- key: nvidia.com/gpu
operator: Equal
value: "true"
effect: NoSchedule
containers:
- name: cuda-smoke
image: harbor.example.local/ai/cuda-sample:vectorAdd
resources:
limits:
nvidia.com/gpu: "1"kubectl apply -f 01-namespaces.yaml
kubectl apply -f - <<'EOF'
# …上列 Job…
EOF
kubectl logs job/gpu-smoke -n gpu-infer
kubectl delete job gpu-smoke -n gpu-inferPass:Job Completed,日志显示 CUDA device OK;Fail:Pending + Insufficient nvidia.com/gpu → 回查 Device Plugin。
5. 推理工作负载(vLLM)
5.1 模型与副本策略
| Deployment | 逻辑模型名 | 副本 | 卡/副本 | 用途 |
|---|---|---|---|---|
vllm-qwen36-27b | qwen3.6-27b | 2 | 1 | 对齐现网主模型;滚动更新可保 1 副本在线 |
vllm-qwen-small | qwen-small | 1 | 1 | 演示多模型路由 / 低成本分流 |
卡占用:2+1=3,在配额 8 以内,剩余给评测或扩容。
5.2 完整清单
| 文件 | 内容 |
|---|---|
03-vllm-qwen-deployment.yaml | 主模型 Deployment + PVC |
04-vllm-service-ingress.yaml | 小模型 Deployment、双 Service、Ingress |
要点(与理论篇一致):
resources.limits/requests的nvidia.com/gpu用整数tolerations必须匹配节点污点- 镜像来自 Harbor 固定 tag(禁止生产依赖
latest) - 模型权重走 PVC(NFS ROX);启动参数
--served-model-name与 LiteLLMmodel对齐
5.3 集群内验收
kubectl -n gpu-infer get deploy,po,svc,ingress
kubectl -n gpu-infer rollout status deploy/vllm-qwen36-27b
# 集群内探活(示例)
kubectl -n gpu-infer run curl --rm -it --image=curlimages/curl -- \
curl -sS http://vllm-qwen36-27b:8000/health从 207 侧(切流前)应先能:
curl -sS http://vllm-qwen.gpu-k8s.example.local/health
curl -sS http://vllm-qwen.gpu-k8s.example.local/v1/models6. Harbor · GitLab · Argo CD
Argo CD 概念、安装、Application 详解见 Argo CD 原理与部署教程。
6.1 流水线(与理论篇案例 C 同构)
开发改 manifests / CI 出镜像
│
▼
Harbor ← push ai/vllm-openai:v0.8.5
│
GitLab ← overlays/prod 更新 image tag
│
Argo CD ← sync Application gpu-infer-workloads
│
gpu-infer NS 滚动更新 vLLMApplication 样例见文末 附录 E · 05-argo-application.yaml(与 patches_cursor/…/05-… 同文)。
kubectl apply -f patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/05-argo-application.yaml
argocd app get gpu-infer-workloads
# 或
kubectl -n argocd get application gpu-infer-workloads6.2 Git 仓建议布局
gpu-infer-manifests/
base/ # Deployment / Service 公共
overlays/prod/ # 副本数、tag、Ingress host
overlays/lab/口诀不变:镜像进 Harbor · 声明进 GitLab · 真相以 Git 为准 · Argo 负责落地。
6.3 与本环境缩样的对应
| 完整 GitOps(本案例) | 本环境缩样(作业17) |
|---|---|
| Argo sync Deployment | 116 上改 Docker / compose |
| Harbor tag | 手工拉镜像 |
| Git 改路由 YAML | 改 patches_cursor/LiteLLM部署/config.yaml + restart |
LiteLLM 路由仍在 207,不进 Argo(本案例边界);集群内推理清单进 Argo。
7. 对上现网:207 LiteLLM 切流
7.1 目标状态
Dify → LiteLLM(207:4000) model=qwen3.6-27b
│ 主
└─► http://vllm-qwen.gpu-k8s.example.local/v1
│ 备(fallback)
└─► http://116.62.10.183:8000/v1 # 现网 Docker,作回滚锚点完整配置样例见文末 附录 F · 06-litellm-cutover-config.yaml(与 patches_cursor/…/06-… 同文)。
7.2 切流步骤(仍走作业17 Runbook 纪律)
- 预检:集群
/health、/v1/models从 207 可达;主 Deployment Ready≥1。 - 备份:拷贝现网
/opt/litellm/config.yaml与 Git 中patches_cursor/LiteLLM部署/config.yaml。 - 改路由:以
06-litellm-cutover-config.yaml为蓝本合并进生产 config(主api_base改 Ingress;保留qwen3.6-27b-docker116+ fallbacks)。 - 发布:同步到 207 →
systemctl restart litellm(或你们现网等价方式)。 - 验收:
# 在 207 或开发机
curl -sS http://192.168.110.207:4000/v1/chat/completions \
-H "Authorization: Bearer sk-litellm-bocheng-207" \
-H "Content-Type: application/json" \
-d "{\"model\":\"qwen3.6-27b\",\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}],\"max_tokens\":16}"- 审计一行:谁、何时、主 upstream 从
116:8000改为vllm-qwen.gpu-k8s…,回滚命令是什么。
7.3 灰度建议
| 阶段 | 做法 |
|---|---|
| 灰 1 | 新增逻辑名 qwen3.6-27b-k8s,仅内部 curl / 测试 Agent 使用 |
| 灰 2 | 生产 qwen3.6-27b 切主到 K8s,fallback 仍指向 116 |
| 灰 3 | 观察 1~3 天:延迟、5xx、GPU 利用率;再考虑缩 116 副本 |
7.4 回滚(先路由、后工作负载)
# 1)路由回滚:api_base 改回 http://116.62.10.183:8000/v1,去掉或倒置 fallback
# 2)restart litellm,curl 验收
# 3)若 K8s 侧坏了:Argo 回滚 Application 或 git revert overlays/prod顺序与 作业17 模型路由配置发布 Runbook 一致:先回滚路由,避免流量打坏 upstream。
8. 配额、限流与值班清单
8.1 集群内
| 项 | 案例约定 |
|---|---|
| ResourceQuota | gpu-infer 最多 8 卡(见 02-quota-and-node-notes.yaml) |
| 副本上限 | 主模型建议 ≤4(留卡给小模型/批任务) |
| 监控 | DCGM Exporter → 已有 Prometheus/Grafana 体系(见集成环境部署专题) |
8.2 网关侧(207)
| 项 | 说明 |
|---|---|
| timeout / max_retries | 见切流 config;避免拖死 Worker |
| fallbacks | 私有挂了回 116 |
| SLA | 继续用现网 Exporter 探 LiteLLM;可另加探 Ingress /health |
8.3 日检(一页)
- [ ]
kubectl -n gpu-infer get po无 CrashLoop / Pending - [ ] 主 Deployment Ready == 期望副本
- [ ] 从 207:
curlIngress/health - [ ] LiteLLM:
/v1/models含qwen3.6-27b;抽测 chat - [ ] Argo Application:Synced + Healthy
- [ ] GPU:DCGM /
nvidia-smi(节点侧)无异常掉卡
9. 故障树
| 现象 | 优先查 | 处置方向 |
|---|---|---|
Pod Pending · Insufficient nvidia.com/gpu | Device Plugin、配额、是否超售 | 等卡 / 降副本 / 查 Operator |
| Pod Pending · 污点 | toleration 是否写上 | 补 toleration 或去掉误 taint |
CUDA driver version is insufficient | 节点驱动 vs 镜像 CUDA | 升驱动或换镜像 tag |
镜像 ImagePullBackOff | Harbor 连通、secret、tag | 拉通仓库;固定 digest |
| Argo OutOfSync / 反复自愈失败 | Git 与活集群被人肉 kubectl 改飘 | 禁止生产手改;以 Git 为准 |
| LiteLLM 5xx / 超时 | 207→Ingress 网络、上游 health、超时设置 | 先 curl Ingress;再 fallback 回 116 |
| 切流后答得慢 | 副本不足、排队、显存 | 扩副本或临时回 116,再容量规划 |
| 只有配置页/部分 Agent 异常 | 多半不是 K8s;查 Dify 插件与专题十七 | 与 GPU 池解耦排查 |
NVIDIA 事件速查习惯与作业17 Part B 相同:kubectl describe po / kubectl get events -n gpu-infer --sort-by=.lastTimestamp。
10. 验收总表与文件清单
10.1 端到端验收(实验集群 + 207 配置演练)
| 步骤 | Pass 标准 |
|---|---|
| 节点 | 3 CP + 6 GPU Worker Ready;GPU 节点有污点与标签 |
| Operator | nvidia.com/gpu 可调度;冒烟 Job 成功 |
| 工作负载 | 主×2 + 小×1 Running;Service/Ingress 通 |
| GitOps | Application Synced;改 tag 能滚动 |
| 切流 | LiteLLM 主上游指向 Ingress;fallback 指向 116 |
| 回滚 | 改回 116 后 chat 恢复;有审计记录 |
10.2 仓库文件
| 路径 | 说明 |
|---|---|
docs/md_cursor/基础设施_K8s_GPU_单私有化集群完整案例/ | 本文 |
patches_cursor/…/01-namespaces.yaml | NS(附录 A) |
…/02-quota-and-node-notes.yaml | 配额与节点约定(附录 B) |
…/03-vllm-qwen-deployment.yaml | 主模型(附录 C) |
…/04-vllm-service-ingress.yaml | 小模型 + Service + Ingress(附录 D) |
…/05-argo-application.yaml | Argo Application(附录 E) |
…/06-litellm-cutover-config.yaml | 207 切流样例(全文见附录 F) |
…/07-gpu-operator-values.yaml | Operator Helm values 片段(附录 G) |
10.3 和现状的一句话对照
现在: Dify/LiteLLM@207 → Docker vLLM@116
目标: Dify/LiteLLM@207 → Ingress→vLLM@单私有化 GPU K8s(116 作 fallback)
理论: 见姊妹篇;多集群/公网分配仍读理论篇,不在本案例展开11. 完整配置附录
下列正文与
patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/下同名文件全文一致,便于离线阅读与复制;kubectl apply/ 合并配置时仍可用仓库路径。
附录 A · 01-namespaces.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/01-namespaces.yaml
# 案例集群命名空间(纸面跟读,勿在 207/116 执行)
apiVersion: v1
kind: Namespace
metadata:
name: gpu-operator
---
apiVersion: v1
kind: Namespace
metadata:
name: gpu-infer
labels:
purpose: inference
---
apiVersion: v1
kind: Namespace
metadata:
name: argocd附录 B · 02-quota-and-node-notes.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/02-quota-and-node-notes.yaml
# gpu-infer 命名空间配额:最多 8 张卡(案例约定)
apiVersion: v1
kind: ResourceQuota
metadata:
name: gpu-infer-quota
namespace: gpu-infer
spec:
hard:
requests.nvidia.com/gpu: "8"
limits.nvidia.com/gpu: "8"
requests.cpu: "64"
requests.memory: 256Gi
pods: "40"
---
# GPU 节点污点:只跑推理(控制面 / 普通业务需容忍或避开)
# 实际执行:kubectl taint nodes gpu-w01 nvidia.com/gpu=true:NoSchedule
# 下列为文档对照用示意;污点通常用 kubectl / 节点 bootstrap,不靠本文件 apply
apiVersion: v1
kind: ConfigMap
metadata:
name: gpu-node-ops-notes
namespace: gpu-infer
data:
taint: "nvidia.com/gpu=true:NoSchedule"
label_present: "nvidia.com/gpu.present=true"
label_product: "nvidia.com/gpu.product=NVIDIA-L40S"附录 C · 03-vllm-qwen-deployment.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/03-vllm-qwen-deployment.yaml
# 主模型:qwen3.6-27b(对齐现网逻辑名);1 卡;挂载模型 PVC
apiVersion: apps/v1
kind: Deployment
metadata:
name: vllm-qwen36-27b
namespace: gpu-infer
labels:
app: vllm-qwen36-27b
model: qwen3.6-27b
spec:
replicas: 2
selector:
matchLabels:
app: vllm-qwen36-27b
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
template:
metadata:
labels:
app: vllm-qwen36-27b
model: qwen3.6-27b
spec:
nodeSelector:
nvidia.com/gpu.present: "true"
tolerations:
- key: nvidia.com/gpu
operator: Equal
value: "true"
effect: NoSchedule
containers:
- name: vllm
image: harbor.example.local/ai/vllm-openai:v0.8.5
args:
- --model
- /models/qwen3.6-27b
- --served-model-name
- qwen3.6-27b
- --host
- 0.0.0.0
- --port
- "8000"
- --tensor-parallel-size
- "1"
ports:
- name: http
containerPort: 8000
env:
- name: HUGGING_FACE_HUB_TOKEN
valueFrom:
secretKeyRef:
name: hf-token
key: token
optional: true
resources:
requests:
cpu: "8"
memory: 48Gi
nvidia.com/gpu: "1"
limits:
cpu: "16"
memory: 64Gi
nvidia.com/gpu: "1"
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 60
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 120
periodSeconds: 20
volumeMounts:
- name: model
mountPath: /models/qwen3.6-27b
readOnly: true
volumes:
- name: model
persistentVolumeClaim:
claimName: pvc-qwen36-27b
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-qwen36-27b
namespace: gpu-infer
spec:
accessModes: ["ReadOnlyMany"]
resources:
requests:
storage: 80Gi
storageClassName: nfs-models附录 D · 04-vllm-service-ingress.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/04-vllm-service-ingress.yaml
# 备模 / 小模型占位:演示多 Deployment + 路由分流
apiVersion: apps/v1
kind: Deployment
metadata:
name: vllm-qwen-small
namespace: gpu-infer
labels:
app: vllm-qwen-small
model: qwen-small
spec:
replicas: 1
selector:
matchLabels:
app: vllm-qwen-small
template:
metadata:
labels:
app: vllm-qwen-small
model: qwen-small
spec:
nodeSelector:
nvidia.com/gpu.present: "true"
tolerations:
- key: nvidia.com/gpu
operator: Equal
value: "true"
effect: NoSchedule
containers:
- name: vllm
image: harbor.example.local/ai/vllm-openai:v0.8.5
args:
- --model
- /models/qwen-small
- --served-model-name
- qwen-small
- --host
- 0.0.0.0
- --port
- "8000"
ports:
- name: http
containerPort: 8000
resources:
requests:
cpu: "4"
memory: 24Gi
nvidia.com/gpu: "1"
limits:
nvidia.com/gpu: "1"
memory: 32Gi
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 45
periodSeconds: 10
volumeMounts:
- name: model
mountPath: /models/qwen-small
readOnly: true
volumes:
- name: model
persistentVolumeClaim:
claimName: pvc-qwen-small
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-qwen-small
namespace: gpu-infer
spec:
accessModes: ["ReadOnlyMany"]
resources:
requests:
storage: 40Gi
storageClassName: nfs-models
---
apiVersion: v1
kind: Service
metadata:
name: vllm-qwen36-27b
namespace: gpu-infer
spec:
selector:
app: vllm-qwen36-27b
ports:
- name: http
port: 8000
targetPort: http
---
apiVersion: v1
kind: Service
metadata:
name: vllm-qwen-small
namespace: gpu-infer
spec:
selector:
app: vllm-qwen-small
ports:
- name: http
port: 8000
targetPort: http
---
# 对 207 LiteLLM 暴露:内网 Ingress(示例域名)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vllm-ingress
namespace: gpu-infer
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "32m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
spec:
ingressClassName: nginx
rules:
- host: vllm-qwen.gpu-k8s.example.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: vllm-qwen36-27b
port:
number: 8000
- host: vllm-small.gpu-k8s.example.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: vllm-qwen-small
port:
number: 8000附录 E · 05-argo-application.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/05-argo-application.yaml
# Argo CD Application:以 Git 为准同步到「单」私有化 GPU 集群
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: gpu-infer-workloads
namespace: argocd
spec:
project: default
source:
repoURL: https://gitlab.example.local/ai-platform/gpu-infer-manifests.git
targetRevision: main
path: overlays/prod
destination:
server: https://kubernetes.default.svc
namespace: gpu-infer
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
# 生产可改为手动 sync;案例演示 automated + selfHeal附录 F · 06-litellm-cutover-config.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/06-litellm-cutover-config.yaml
# 207 LiteLLM 切流样例:主上游 → K8s Ingress;备上游 → 现网 116 Docker vLLM
# 对照:patches_cursor/LiteLLM部署/config.yaml、作业17 主备路由
# 变更仍走:备份 → diff → 拷到 /opt/litellm → systemctl restart litellm → curl 验收
model_list:
- model_name: qwen3.6-27b
litellm_params:
model: openai/qwen3.6-27b
api_base: http://vllm-qwen.gpu-k8s.example.local/v1
api_key: "sk-cluster-gpu"
timeout: 300
max_retries: 2
extra_body:
chat_template_kwargs:
enable_thinking: false
# 回滚锚点:现网 116 Docker vLLM
- model_name: qwen3.6-27b-docker116
litellm_params:
model: openai/qwen3.6-27b
api_base: http://116.62.10.183:8000/v1
api_key: "123456"
timeout: 300
max_retries: 0
- model_name: qwen-small
litellm_params:
model: openai/qwen-small
api_base: http://vllm-small.gpu-k8s.example.local/v1
api_key: "sk-cluster-gpu"
timeout: 120
max_retries: 1
litellm_settings:
drop_params: true
set_verbose: false
request_timeout: 300
num_retries: 2
fallbacks:
- qwen3.6-27b: [qwen3.6-27b-docker116]
router_settings:
routing_strategy: simple-shuffle
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY附录 G · 07-gpu-operator-values.yaml
路径:patches_cursor/基础设施_K8s_GPU_单私有化集群完整案例/07-gpu-operator-values.yaml
# GPU Operator Helm values 片段(纸面跟读;版本号以官网稳定版为准)
# helm upgrade --install gpu-operator nvidia/gpu-operator \
# -n gpu-operator --create-namespace -f 07-gpu-operator-values.yaml
driver:
enabled: true
toolkit:
enabled: true
devicePlugin:
enabled: true
dcgmExporter:
enabled: true
gfd:
enabled: true
migManager:
enabled: false
# 若节点已由 OS 镜像固化驱动,可改 driver.enabled=false,只装 toolkit + plugin
operator:
defaultRuntime: containerd修订记录
| 日期 | 说明 |
|---|---|
| 2026-09-01 | 首版:中等规模单集群完整案例(应用留 207、GPU 进 K8s、GitOps + LiteLLM 切流) |
| 2026-09-01 | 文末增加 01~07 完整配置附录(与 patches 同文) |