Files
cluster-knaster/deploy/k8s/llamacpp/llamacpp.yaml.j2
T
Robert RappandClaude Opus 5.5 986f1116fe
ci / test (push) Failing after 22s
k3s: llama.cpp-Server als Deployments (Task 6.1)
Ein Pod je GPU-VM (Embed+Rerank bzw. Chat), Host-Netz mit den Ports aus dem
Compose, P2000 fest per UUID (NVIDIA_VISIBLE_DEVICES). Das Device Plugin
vergibt nur noch Index 0 (M4000). Rolle gpu-llamacpp: gemeinsame Vorbereitung
(prepare.yml), k3s.yml mit Image-Import und Compose-Stopp; gpu-llamacpp.yml
bricht ohne -e llamacpp_compose=true ab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:27:23 +02:00

63 lines
2.7 KiB
Django/Jinja

# llama.cpp-Server je GPU-VM in k3s (Task 6.1, D6), gerendert von der Rolle gpu-llamacpp (tasks/k3s.yml) je Knoten.
# Ein Pod je Knoten; im Profil embed laufen Embedding und Rerank als zwei Container auf derselben P2000.
# Kartenwahl: kein nvidia.com/gpu (das Device Plugin verwaltet nur die M4000, Index 0), sondern die UUID der P2000
# per NVIDIA_VISIBLE_DEVICES, ermittelt und geprüft über den Kartennamen (ADR-0006: M4000 bleibt frei).
# Host-Netz mit den Ports wie zuvor im Compose (8080/8081/8082): Prometheus-Ziele (file_sd) und ufw bleiben gültig.
# Image aus dem Compose-Build, in das containerd von k3s importiert (imagePullPolicy Never).
# Datenschutz wie im Compose: kein --verbose, /slots aus, keine Web-Oberfläche.
apiVersion: apps/v1
kind: Deployment
metadata:
name: llamacpp-{{ inventory_hostname }}
namespace: knaster
labels: {app: llamacpp, knaster.node: {{ inventory_hostname }}}
spec:
replicas: 1
strategy: {type: Recreate} # Host-Ports und VRAM der P2000 können nur einmal belegt sein
selector:
matchLabels: {app: llamacpp, knaster.node: {{ inventory_hostname }}}
template:
metadata:
labels: {app: llamacpp, knaster.node: {{ inventory_hostname }}}
spec:
runtimeClassName: nvidia
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
nodeSelector:
kubernetes.io/hostname: {{ inventory_hostname }}
containers:
{% for svc in llamacpp_k3s_containers %}
- name: {{ svc.name }}
image: {{ llamacpp_image }}
imagePullPolicy: Never
args: {{ svc.args | to_json }}
env:
- {name: NVIDIA_VISIBLE_DEVICES, value: "{{ llamacpp_gpu_env[svc.gpu_var] }}"}
- {name: NVIDIA_DRIVER_CAPABILITIES, value: "compute,utility"}
resources:
requests: {cpu: 500m, memory: 1Gi}
limits: {memory: {{ svc.memory_limit }}}
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- {name: models, mountPath: /models, readOnly: true}
- {name: tmp, mountPath: /tmp}
startupProbe:
httpGet: {path: /health, port: {{ svc.port }}, host: 127.0.0.1}
periodSeconds: 5
failureThreshold: 60
readinessProbe:
httpGet: {path: /health, port: {{ svc.port }}, host: 127.0.0.1}
periodSeconds: 30
livenessProbe:
httpGet: {path: /health, port: {{ svc.port }}, host: 127.0.0.1}
periodSeconds: 30
failureThreshold: 3
{% endfor %}
volumes:
- name: models
hostPath: {path: {{ llamacpp_models_dir }}, type: Directory}
- name: tmp
emptyDir: {sizeLimit: 64Mi}