feat: add ComfyUI, rebalance GPU allocation
GPU rebalance (4× V100 32GB on worker-1): - reasoning: 2 GPU (unchanged, PP=2 for Qwen3-32B) - ornith: 2→1 GPU (scale to 1 replica, ornith:35b only) - comfyui: 0→1 GPU (new) - embeddings/reranker: 0 GPU (CPU, unchanged) qwen2.5:3b-instruct moved to CPU on talos-cp-2 (144GB RAM). Separate Ollama deployment + 5Gi PVC, pulls model on first start. Gateway config updated in homelab-frontend (separate commit). Co-authored-by: poimen <[email protected]>
This commit is contained in:
@@ -14,6 +14,7 @@ resources:
|
||||
- ornith.yaml
|
||||
- reasoning.yaml
|
||||
- reranker.yaml
|
||||
- qwen-cpu.yaml
|
||||
- networkpolicy.yaml
|
||||
# No namespace transformer: every file sets its own, and the transformer would
|
||||
# rewrite metadata.namespace on anything cross-namespace added later.
|
||||
|
||||
@@ -33,12 +33,8 @@ spec:
|
||||
|
||||
ollama pull ornith:35b
|
||||
|
||||
ollama pull qwen2.5:3b-instruct
|
||||
|
||||
ollama run ornith:35b "ok" >/dev/null 2>&1 || true
|
||||
|
||||
ollama run qwen2.5:3b-instruct "ok" >/dev/null 2>&1 || true
|
||||
|
||||
wait $SERVE_PID
|
||||
|
||||
'
|
||||
@@ -54,7 +50,7 @@ spec:
|
||||
- name: OLLAMA_NUM_PARALLEL
|
||||
value: '1'
|
||||
- name: OLLAMA_MAX_LOADED_MODELS
|
||||
value: '2'
|
||||
value: '1'
|
||||
image: ollama/ollama:0.32.9@sha256:1685741456770df6e3cceb2a945a5f75e020f658d1701509668d6f4688f1dd3f
|
||||
name: kserve-container
|
||||
ports:
|
||||
@@ -65,8 +61,7 @@ spec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- ollama ps 2>/dev/null | grep -q ornith && ollama ps 2>/dev/null |
|
||||
grep -q qwen2.5
|
||||
- ollama ps 2>/dev/null | grep -q ornith
|
||||
periodSeconds: 10
|
||||
resources:
|
||||
limits:
|
||||
@@ -82,8 +77,7 @@ spec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- ollama ps 2>/dev/null | grep -q ornith && ollama ps 2>/dev/null |
|
||||
grep -q qwen2.5
|
||||
- ollama ps 2>/dev/null | grep -q ornith
|
||||
failureThreshold: 120
|
||||
periodSeconds: 15
|
||||
volumeMounts:
|
||||
@@ -91,13 +85,10 @@ spec:
|
||||
name: models
|
||||
deploymentStrategy:
|
||||
type: Recreate
|
||||
# 2 replicas -- each its own GPU, each loading both ornith:35b and
|
||||
# qwen2.5:3b-instruct -- so 2 concurrent implementer-style calls each
|
||||
# get an independent instance instead of contending on one, at the
|
||||
# cost of judge/qwen traffic still sharing whichever replica an
|
||||
# implementer call also lands on.
|
||||
maxReplicas: 2
|
||||
minReplicas: 2
|
||||
# 1 replica -- ornith:35b only. qwen2.5:3b moved to CPU on cp-2.
|
||||
# Frees 1 GPU for ComfyUI.
|
||||
maxReplicas: 1
|
||||
minReplicas: 1
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: worker-1
|
||||
runtimeClassName: nvidia
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
# qwen2.5:3b-instruct on CPU (talos-cp-2, 144GB RAM, 24 cores).
|
||||
# Moved off GPU to free a V100 for ComfyUI. Latency ~10x slower
|
||||
# than GPU but sufficient for lightweight tasks (summarization,
|
||||
# classification, quick answers).
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: qwen-cpu
|
||||
namespace: llm-serving
|
||||
labels:
|
||||
app: qwen-cpu
|
||||
app.kubernetes.io/name: qwen-cpu
|
||||
app.kubernetes.io/part-of: llm-serving
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: qwen-cpu
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: qwen-cpu
|
||||
app.kubernetes.io/name: qwen-cpu
|
||||
app.kubernetes.io/part-of: llm-serving
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: talos-cp-2
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/control-plane
|
||||
operator: Exists
|
||||
effect: NoSchedule
|
||||
containers:
|
||||
- name: ollama
|
||||
image: ollama/ollama:0.32.9@sha256:1685741456770df6e3cceb2a945a5f75e020f658d1701509668d6f4688f1dd3f
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
ollama serve &
|
||||
SERVE_PID=$!
|
||||
until ollama list >/dev/null 2>&1; do sleep 2; done
|
||||
ollama pull qwen2.5:3b-instruct
|
||||
ollama run qwen2.5:3b-instruct "ok" >/dev/null 2>&1 || true
|
||||
wait $SERVE_PID
|
||||
env:
|
||||
- name: OLLAMA_HOST
|
||||
value: "0.0.0.0:8080"
|
||||
- name: OLLAMA_MODELS
|
||||
value: /root/.ollama/models
|
||||
- name: OLLAMA_CONTEXT_LENGTH
|
||||
value: "32768"
|
||||
- name: OLLAMA_KEEP_ALIVE
|
||||
value: "-1"
|
||||
- name: OLLAMA_MAX_LOADED_MODELS
|
||||
value: "1"
|
||||
- name: OLLAMA_NUM_PARALLEL
|
||||
value: "2"
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: ["/bin/sh", "-c", "ollama ps 2>/dev/null | grep -q qwen2.5"]
|
||||
periodSeconds: 10
|
||||
startupProbe:
|
||||
exec:
|
||||
command: ["/bin/sh", "-c", "ollama ps 2>/dev/null | grep -q qwen2.5"]
|
||||
failureThreshold: 60
|
||||
periodSeconds: 10
|
||||
resources:
|
||||
requests:
|
||||
cpu: "4"
|
||||
memory: 4Gi
|
||||
limits:
|
||||
cpu: "8"
|
||||
memory: 8Gi
|
||||
volumeMounts:
|
||||
- mountPath: /root/.ollama
|
||||
name: ollama-data
|
||||
volumes:
|
||||
- name: ollama-data
|
||||
persistentVolumeClaim:
|
||||
claimName: qwen-cpu-data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: qwen-cpu
|
||||
namespace: llm-serving
|
||||
labels:
|
||||
app: qwen-cpu
|
||||
app.kubernetes.io/part-of: llm-serving
|
||||
spec:
|
||||
selector:
|
||||
app: qwen-cpu
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
---
|
||||
# Small PVC for qwen2.5:3b model weights (~1.9GB).
|
||||
# Separate from llm-models PVC which is pinned to worker-1.
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: qwen-cpu-data
|
||||
namespace: llm-serving
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: longhorn
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
Reference in New Issue
Block a user