Files
homelab/k8s/apps/llm-serving/inferenceservice-embeddings.yaml
T

75 lines
2.5 KiB
YAML
Raw Normal View History

# Embeddings — Nomic Embed Text v2 (MoE), on CPU via HuggingFace TEI.
#
# CPU, not GPU, deliberately. All 4 V100s are claimed by the generation models,
# and the device plugin hands out WHOLE GPUs — a 5th GPU-requesting pod is
# unschedulable no matter how much VRAM is free. Sharing would need global
# time-slicing, which on a single node cannot be scoped to one card and would let
# the scheduler co-locate two ~20GB models and OOM both.
#
# worker-1 has 96 cores with ~250m requested, and this is a 475M-param encoder
# (305M active). Retrieval runs once per agent-loop iteration, not per token, so
# CPU latency here is immaterial. This is also what Plan 1 originally specified.
#
# TEI (not vLLM) because it is purpose-built for encoders and explicitly lists
# nomic-embed-text-v2-moe as supported.
#
# NOTE: Nomic v2 requires task prefixes on the CLIENT side —
# documents: "search_document: <text>"
# queries: "search_query: <text>"
# Embedding without the prefix silently degrades retrieval quality.
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: embeddings
labels:
app.kubernetes.io/name: llm-embeddings
app.kubernetes.io/part-of: llm-serving
spec:
predictor:
minReplicas: 1
maxReplicas: 1
# Pinned to worker-1 only so it can share the RWO models PVC with the GPU
# pods (RWO = single node, any number of pods on it).
nodeSelector:
kubernetes.io/hostname: worker-1
containers:
- name: kserve-container
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.8.2@sha256:4d632b76bd14cb57044a1ffb0ad48ab0ba4939e705a9a615ccc740658575c26e
args:
- --model-id=nomic-ai/nomic-embed-text-v2-moe
- --port=8080
- --hostname=0.0.0.0
# Truncate rather than 413 on over-long input.
- --auto-truncate
env:
- name: HUGGINGFACE_HUB_CACHE
value: /mnt/models
ports:
- containerPort: 8080
protocol: TCP
resources:
requests:
cpu: "8"
memory: 4Gi
limits:
cpu: "16"
memory: 8Gi
volumeMounts:
- name: models
mountPath: /mnt/models
startupProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 10
failureThreshold: 60
readinessProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 10
volumes:
- name: models
persistentVolumeClaim:
claimName: llm-models