Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8790de6038 |
@@ -0,0 +1,80 @@
|
|||||||
|
# ComfyUI — GPU-accelerated image generation on worker-1.
|
||||||
|
# Uses 1x V100 32GB (sm70). Freed by scaling ornith 2→1.
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: comfyui
|
||||||
|
namespace: comfyui
|
||||||
|
labels:
|
||||||
|
app: comfyui
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: comfyui
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: comfyui
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: worker-1
|
||||||
|
runtimeClassName: nvidia
|
||||||
|
containers:
|
||||||
|
- name: comfyui
|
||||||
|
image: ghcr.io/ai-dock/comfyui:v2-cuda-12.1.1-base-22.04
|
||||||
|
ports:
|
||||||
|
- containerPort: 8188
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: NVIDIA_VISIBLE_DEVICES
|
||||||
|
value: "all"
|
||||||
|
- name: COMFYUI_FLAGS
|
||||||
|
value: "--listen 0.0.0.0 --port 8188"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "4"
|
||||||
|
memory: 8Gi
|
||||||
|
nvidia.com/gpu: "1"
|
||||||
|
limits:
|
||||||
|
cpu: "8"
|
||||||
|
memory: 16Gi
|
||||||
|
nvidia.com/gpu: "1"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /workspace/ComfyUI/models
|
||||||
|
name: models
|
||||||
|
- mountPath: /workspace/ComfyUI/output
|
||||||
|
name: output
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8188
|
||||||
|
periodSeconds: 10
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
startupProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8188
|
||||||
|
failureThreshold: 60
|
||||||
|
periodSeconds: 10
|
||||||
|
volumes:
|
||||||
|
- name: models
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: comfyui-models
|
||||||
|
- name: output
|
||||||
|
emptyDir: {}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: comfyui-models
|
||||||
|
namespace: comfyui
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
storageClassName: longhorn
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 50Gi
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: comfyui
|
||||||
|
namespace: comfyui
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
|
||||||
|
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
|
||||||
|
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
||||||
|
# WebSocket support for ComfyUI's live preview
|
||||||
|
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
|
||||||
|
nginx.ingress.kubernetes.io/proxy-set-headers: "Upgrade"
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
rules:
|
||||||
|
- host: comfy.riotpiao.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: comfyui
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
|
- ingress.yaml
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: comfyui
|
||||||
|
namespace: comfyui
|
||||||
|
labels:
|
||||||
|
app: comfyui
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: comfyui
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8188
|
||||||
|
protocol: TCP
|
||||||
@@ -14,6 +14,7 @@ resources:
|
|||||||
- ornith.yaml
|
- ornith.yaml
|
||||||
- reasoning.yaml
|
- reasoning.yaml
|
||||||
- reranker.yaml
|
- reranker.yaml
|
||||||
|
- qwen-cpu.yaml
|
||||||
- networkpolicy.yaml
|
- networkpolicy.yaml
|
||||||
# No namespace transformer: every file sets its own, and the transformer would
|
# No namespace transformer: every file sets its own, and the transformer would
|
||||||
# rewrite metadata.namespace on anything cross-namespace added later.
|
# rewrite metadata.namespace on anything cross-namespace added later.
|
||||||
|
|||||||
@@ -33,12 +33,8 @@ spec:
|
|||||||
|
|
||||||
ollama pull ornith:35b
|
ollama pull ornith:35b
|
||||||
|
|
||||||
ollama pull qwen2.5:3b-instruct
|
|
||||||
|
|
||||||
ollama run ornith:35b "ok" >/dev/null 2>&1 || true
|
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
|
wait $SERVE_PID
|
||||||
|
|
||||||
'
|
'
|
||||||
@@ -54,7 +50,7 @@ spec:
|
|||||||
- name: OLLAMA_NUM_PARALLEL
|
- name: OLLAMA_NUM_PARALLEL
|
||||||
value: '1'
|
value: '1'
|
||||||
- name: OLLAMA_MAX_LOADED_MODELS
|
- name: OLLAMA_MAX_LOADED_MODELS
|
||||||
value: '2'
|
value: '1'
|
||||||
image: ollama/ollama:0.32.9@sha256:1685741456770df6e3cceb2a945a5f75e020f658d1701509668d6f4688f1dd3f
|
image: ollama/ollama:0.32.9@sha256:1685741456770df6e3cceb2a945a5f75e020f658d1701509668d6f4688f1dd3f
|
||||||
name: kserve-container
|
name: kserve-container
|
||||||
ports:
|
ports:
|
||||||
@@ -65,8 +61,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- ollama ps 2>/dev/null | grep -q ornith && ollama ps 2>/dev/null |
|
- ollama ps 2>/dev/null | grep -q ornith
|
||||||
grep -q qwen2.5
|
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
@@ -82,8 +77,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- ollama ps 2>/dev/null | grep -q ornith && ollama ps 2>/dev/null |
|
- ollama ps 2>/dev/null | grep -q ornith
|
||||||
grep -q qwen2.5
|
|
||||||
failureThreshold: 120
|
failureThreshold: 120
|
||||||
periodSeconds: 15
|
periodSeconds: 15
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -91,13 +85,10 @@ spec:
|
|||||||
name: models
|
name: models
|
||||||
deploymentStrategy:
|
deploymentStrategy:
|
||||||
type: Recreate
|
type: Recreate
|
||||||
# 2 replicas -- each its own GPU, each loading both ornith:35b and
|
# 1 replica -- ornith:35b only. qwen2.5:3b moved to CPU on cp-2.
|
||||||
# qwen2.5:3b-instruct -- so 2 concurrent implementer-style calls each
|
# Frees 1 GPU for ComfyUI.
|
||||||
# get an independent instance instead of contending on one, at the
|
maxReplicas: 1
|
||||||
# cost of judge/qwen traffic still sharing whichever replica an
|
minReplicas: 1
|
||||||
# implementer call also lands on.
|
|
||||||
maxReplicas: 2
|
|
||||||
minReplicas: 2
|
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: worker-1
|
kubernetes.io/hostname: worker-1
|
||||||
runtimeClassName: nvidia
|
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
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: comfyui
|
||||||
|
namespace: argocd
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: comfyui
|
||||||
|
app.kubernetes.io/component: image-generation
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "8"
|
||||||
|
spec:
|
||||||
|
project: homelab
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
source:
|
||||||
|
repoURL: https://forgejo.riotpiao.com/rock/homelab.git
|
||||||
|
targetRevision: main
|
||||||
|
path: k8s/apps/comfyui
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: comfyui
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
retry:
|
||||||
|
limit: 5
|
||||||
|
backoff:
|
||||||
|
duration: 5s
|
||||||
|
factor: 2
|
||||||
|
maxDuration: 3m
|
||||||
Reference in New Issue
Block a user