k3s: llama.cpp-Server als Deployments (Task 6.1)
ci / test (push) Failing after 22s

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>
This commit is contained in:
Robert Rapp
2026-10-19 17:27:23 +02:00
co-authored by Claude Opus 5.5
parent 24f4066aaf
commit 986f1116fe
9 changed files with 278 additions and 37 deletions
+62
View File
@@ -0,0 +1,62 @@
# 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}
+6
View File
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: knaster
labels:
knaster.app: llamacpp
+4
View File
@@ -31,6 +31,10 @@ spec:
env:
- name: FAIL_ON_INIT_ERROR
value: "false"
# Nur Index 0 (Quadro M4000 in allen GPU-VMs, geprüft in playbooks/gpu-llamacpp-k3s.yml) wird als
# nvidia.com/gpu vergeben. Die P2000 gehört fest den llama.cpp-Pods (per UUID, Task 6.1).
- name: NVIDIA_VISIBLE_DEVICES
value: "0"
securityContext:
allowPrivilegeEscalation: false
capabilities: