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
@@ -0,0 +1,52 @@
# llama.cpp-Rollen nach k3s (Task 6.1, D6). Läuft auf ops (Verzeichnis platform/proxmox/ansible):
# ansible-playbook playbooks/gpu-llamacpp-k3s.yml # alle VMs der Gruppe gpu_llamacpp
# ansible-playbook playbooks/gpu-llamacpp-k3s.yml -e llamacpp_k3s_hosts=gpu-pve44 # nur eine VM (Pilot)
# Danach: ansible-playbook playbooks/monitoring-targets.yml (Ziele bleiben gleich, Ports wie im Compose).
#
# Kartenwahl: Das Device Plugin verwaltet nur Index 0 (M4000, in allen GPU-VMs); die P2000 bekommen die
# llama.cpp-Pods fest per UUID. Erst prüfen, dass Index 0 überall die M4000 ist, dann das Device Plugin anwenden.
- name: GPU-VMs – Index 0 ist die M4000
hosts: gpu_vms
gather_facts: false
tasks:
- name: Karte auf Index 0 lesen
ansible.builtin.command: nvidia-smi -i 0 --query-gpu=name --format=csv,noheader
register: gpu0
changed_when: false
- name: Index 0 muss die M4000 sein (sonst gibt das Device Plugin die falsche Karte frei)
ansible.builtin.assert:
that: gpu0.stdout == "Quadro M4000"
fail_msg: "{{ inventory_hostname }}: Index 0 ist {{ gpu0.stdout }}"
- name: k3s – Device Plugin nur für die M4000
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Device Plugin anwenden
ansible.builtin.command: kubectl apply -f {{ playbook_dir }}/../../../../deploy/k8s/nvidia-device-plugin.yaml
register: dp
changed_when: "'configured' in dp.stdout"
- name: Warten, bis das Device Plugin auf allen Knoten läuft
ansible.builtin.command: kubectl -n kube-system rollout status daemonset/nvidia-device-plugin-daemonset --timeout=180s
changed_when: false
- name: Jede GPU-VM meldet genau eine Karte (M4000)
ansible.builtin.command: kubectl get node {{ item }} -o jsonpath='{.status.allocatable.nvidia\.com/gpu}'
loop: "{{ groups['gpu_vms'] }}"
register: alloc
until: alloc.stdout == "1"
retries: 24
delay: 5
changed_when: false
- name: llama.cpp-Server in k3s
hosts: "{{ llamacpp_k3s_hosts | default('gpu_llamacpp') }}"
serial: 1
tasks:
- name: Rolle gpu-llamacpp (k3s)
ansible.builtin.include_role:
name: gpu-llamacpp
tasks_from: k3s
@@ -3,6 +3,14 @@
# Aufruf auf ops (Verzeichnis platform/proxmox/ansible), vorher Zugang auffrischen (refresh-vm-access.sh):
# ansible-playbook playbooks/gpu-llamacpp.yml
# ansible-playbook playbooks/monitoring-targets.yml # Prometheus-Ziele (file_sd) nachziehen
#
# Seit 19.10. laufen die Server in k3s (playbooks/gpu-llamacpp-k3s.yml). Dieses Playbook würde den Compose-Stack
# wieder starten und Host-Ports und VRAM doppelt belegen. Nur mit -e llamacpp_compose=true (Rückweg).
- name: llama.cpp-Server in den GPU-VMs
hosts: gpu_llamacpp
pre_tasks:
- name: Abbruch, wenn llama.cpp in k3s läuft
ansible.builtin.fail:
msg: "llama.cpp läuft in k3s (playbooks/gpu-llamacpp-k3s.yml). Compose nur mit -e llamacpp_compose=true."
when: not (llamacpp_compose | default(false) | bool)
roles: [gpu-llamacpp]