- Keep agents, KB collections, users and runtime settings (LOCALAI_DATA_PATH, LOCALAI_CONFIG_DIR) and backends (LOCALAI_BACKENDS_PATH) on the models PVC. The chart's /data, /configuration and /backends are ephemeral, so every pod restart wiped the agent team and the llama.cpp backend. - Default the agent pool to ornith-1.5-9b-q8 with granite-embedding-107m-multilingual embeddings. - Make the image tag a variable, defaulting to the CUDA 13 image that runs. - Patch hostNetwork and the LOCALAI_P2P_TOKEN secretKeyRef (Secret localai/localai-p2p) onto the Deployment after Helm. Both were set by hand, and applying the role would otherwise revert them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
122 lines
3.8 KiB
YAML
122 lines
3.8 KiB
YAML
#SPDX-License-Identifier: MIT-0
|
|
---
|
|
# tasks file for localai
|
|
- name: Add skynet repo
|
|
kubernetes.core.helm_repository:
|
|
name: go-skynet
|
|
repo_url: https://go-skynet.github.io/helm-charts/
|
|
register: repo_update
|
|
|
|
- name: Update Helm repos
|
|
command: helm repo update
|
|
when: repo_update.changed
|
|
|
|
- name: Deploy LocalAI
|
|
kubernetes.core.helm:
|
|
name: localai
|
|
chart_ref: go-skynet/local-ai
|
|
release_namespace: localai
|
|
create_namespace: true
|
|
values:
|
|
deployment:
|
|
image:
|
|
tag: "{{ localai_image_tag }}"
|
|
pullPolicy: Always
|
|
runtimeClassName: nvidia
|
|
secretEnv:
|
|
- name: LOCALAI_DISABLE_WEBUI
|
|
value: "{{ localai_disable_webui }}"
|
|
- name: LOCALAI_API_KEY
|
|
value: "{{ localai_api_keys | join(',') }}"
|
|
- name: LOCALAI_WATCHDOG_IDLE
|
|
value: "{{ localai_watchdog_idle }}"
|
|
- name: LOCALAI_WATCHDOG_IDLE_TIMEOUT
|
|
value: "{{ localai_watchdog_idle_timeout }}"
|
|
- name: LOCALAI_WATCHDOG_BUSY
|
|
value: "{{ localai_watchdog_busy }}"
|
|
- name: DEBUG
|
|
value: "{{ localai_debug }}"
|
|
- name: LOCALAI_P2P
|
|
value: "{{ localai_p2p }}"
|
|
- name: LOCALAI_FEDERATED
|
|
value: "{{ localai_federated }}"
|
|
# Keep agents, knowledge-base collections, users and runtime settings
|
|
# on the models PVC; the chart's default /data and /configuration are
|
|
# ephemeral, so a pod restart used to wipe them.
|
|
- name: LOCALAI_DATA_PATH
|
|
value: "{{ localai_data_path }}"
|
|
- name: LOCALAI_CONFIG_DIR
|
|
value: "{{ localai_config_dir }}"
|
|
- name: LOCALAI_BACKENDS_PATH
|
|
value: "{{ localai_backends_path }}"
|
|
- name: LOCALAI_AGENT_POOL_DEFAULT_MODEL
|
|
value: "{{ localai_agent_pool_default_model }}"
|
|
- name: LOCALAI_AGENT_POOL_EMBEDDING_MODEL
|
|
value: "{{ localai_agent_pool_embedding_model }}"
|
|
resources:
|
|
limits:
|
|
nvidia.com/gpu: 1
|
|
persistence:
|
|
models:
|
|
size: 256Gi
|
|
output:
|
|
size: 128Gi
|
|
tolerations:
|
|
- key: specialResources
|
|
operator: Equal
|
|
value: GPU
|
|
effect: NoSchedule
|
|
ingress:
|
|
enabled: true
|
|
className: nginx
|
|
annotations:
|
|
cert-manager.io/cluster-issuer: ca-issuer
|
|
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
|
|
nginx.ingress.kubernetes.io/proxy-set-header: "X-Forwarded-For"
|
|
hosts:
|
|
- host: localai.eom.dev
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
tls:
|
|
- secretName: localai-tls
|
|
hosts:
|
|
- localai.eom.dev
|
|
|
|
# The chart has no values for these, so patch them onto the Deployment after
|
|
# Helm. hostNetwork lets p2p workers on the LAN reach the server directly.
|
|
- name: Enable host networking
|
|
kubernetes.core.k8s:
|
|
state: patched
|
|
kind: Deployment
|
|
name: localai-local-ai
|
|
namespace: localai
|
|
definition:
|
|
spec:
|
|
template:
|
|
spec:
|
|
hostNetwork: true
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
when: localai_host_network | bool
|
|
|
|
# The p2p token lives in a Secret created outside this role (localai/localai-p2p).
|
|
- name: Read the p2p token from its Secret
|
|
kubernetes.core.k8s:
|
|
state: patched
|
|
kind: Deployment
|
|
name: localai-local-ai
|
|
namespace: localai
|
|
definition:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: local-ai
|
|
env:
|
|
- name: LOCALAI_P2P_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: "{{ localai_p2p_token_secret }}"
|
|
key: LOCALAI_P2P_TOKEN
|
|
when: localai_p2p_token_secret | length > 0
|