titan-iac/services/hermes/ollama-deployment.yaml

121 lines
3.5 KiB
YAML
Raw Normal View History

2026-07-21 21:02:06 -03:00
# services/hermes/ollama-deployment.yaml
2026-05-19 19:17:14 -03:00
apiVersion: apps/v1
kind: Deployment
metadata:
2026-07-21 21:02:06 -03:00
name: hermes-ollama
namespace: hermes
2026-05-19 19:17:14 -03:00
labels:
2026-07-21 21:02:06 -03:00
app: hermes-ollama
2026-05-19 19:17:14 -03:00
spec:
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
2026-07-21 21:02:06 -03:00
app: hermes-ollama
2026-05-19 19:17:14 -03:00
template:
metadata:
labels:
2026-07-21 21:02:06 -03:00
app: hermes-ollama
2026-05-19 19:17:14 -03:00
annotations:
ai.bstein.dev/model: gpt-oss:20b
ai.bstein.dev/gpu: titan-24 local-first lane
2026-05-19 19:17:14 -03:00
spec:
runtimeClassName: nvidia
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- titan-24
2026-05-19 19:17:14 -03:00
volumes:
- name: models
persistentVolumeClaim:
claimName: hermes-models
2026-05-19 19:17:14 -03:00
initContainers:
- name: warm-model
image: ollama/ollama@sha256:2c9595c555fd70a28363489ac03bd5bf9e7c5bdf2890373c3a830ffd7252ce6d
imagePullPolicy: IfNotPresent
env:
- name: OLLAMA_HOST
value: 0.0.0.0
- name: OLLAMA_MODELS
value: /root/.ollama
- name: OLLAMA_MODEL
value: gpt-oss:20b
2026-05-19 19:17:14 -03:00
- name: NVIDIA_VISIBLE_DEVICES
value: all
- name: NVIDIA_DRIVER_CAPABILITIES
value: compute,utility
command:
- /bin/sh
- -c
- |
set -e
ollama serve >/tmp/ollama.log 2>&1 &
sleep 6
ollama pull "${OLLAMA_MODEL}"
pkill ollama || true
volumeMounts:
- name: models
mountPath: /root/.ollama
resources:
requests:
cpu: "1"
memory: 4Gi
nvidia.com/gpu.shared: 1
limits:
cpu: "4"
memory: 16Gi
2026-05-19 19:17:14 -03:00
nvidia.com/gpu.shared: 1
containers:
- name: ollama
image: ollama/ollama@sha256:2c9595c555fd70a28363489ac03bd5bf9e7c5bdf2890373c3a830ffd7252ce6d
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 11434
env:
- name: OLLAMA_HOST
value: 0.0.0.0
- name: OLLAMA_KEEP_ALIVE
value: 6h
- name: OLLAMA_CONTEXT_LENGTH
value: "64000"
- name: OLLAMA_FLASH_ATTENTION
value: "1"
- name: OLLAMA_KV_CACHE_TYPE
value: q8_0
- name: OLLAMA_MAX_LOADED_MODELS
value: "1"
- name: OLLAMA_NUM_PARALLEL
value: "1"
2026-05-19 19:17:14 -03:00
- name: OLLAMA_MODELS
value: /root/.ollama
- name: NVIDIA_VISIBLE_DEVICES
value: all
- name: NVIDIA_DRIVER_CAPABILITIES
value: compute,utility
volumeMounts:
- name: models
mountPath: /root/.ollama
readinessProbe:
httpGet:
path: /api/tags
port: 11434
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "8"
memory: 24Gi
2026-05-19 19:17:14 -03:00
nvidia.com/gpu.shared: 1
limits:
cpu: "16"
memory: 40Gi
2026-05-19 19:17:14 -03:00
nvidia.com/gpu.shared: 1