# ============================================================================= # Agent Zero AI Stack — NUC Deployment (RKE2 Bare-Metal) # ============================================================================= # Deploys: AgentZero (agent UI) on RKE2 cluster with Blue Jay profile # Ollama: edge1 Pi 5 + AI HAT+ ONLY (10.0.57.17:11434). # Workstation Ollama (BLUEJAY-WS) is intentionally NOT in the upstream — # the workstation is private dev hardware, not a cluster dependency. # Target: RKE2 bare-metal cluster, namespace: agent-zero # Profile: Blue Jay (21 tools, 3 prompts, 4 extensions, theme) # # Differences from LOCAL (WSL K3s): # - Uses Longhorn StorageClass (not local-path) # - Cluster-only Ollama path (edge1) — keeps workstation private # - NO Anthropic API key (free/local models only) # - NO Piper TTS or Kiwix (edge1 handles TTS, no Wikipedia needed) # - NO hostPath volumes — profile/tools/extensions loaded via ConfigMaps # - Traefik IngressRoute for LAN access at agent-zero.iamworkin.lan # # ConfigMaps (defined in configmaps-bluejay.yaml): # bluejay-tools 21 Python tool modules (~520K) # bluejay-profile agent.json, agent.yaml, system_prompt.md (~20K) # bluejay-prompts 3 prompt templates (~11K) # flowercore-extensions 5 Python extension modules (~76K) # bluejay-theme CSS theme (~7K) # # Apply: KUBECONFIG=~/.kube/rke2.yaml kubectl apply -f agent-zero-nuc.yaml # ============================================================================= --- apiVersion: v1 kind: Namespace metadata: name: agent-zero labels: app.kubernetes.io/part-of: agent-zero-stack # ============================================================================= # Persistent Volume Claims (Longhorn) # ============================================================================= --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: agent-zero-data namespace: agent-zero spec: accessModes: [ReadWriteOnce] storageClassName: longhorn resources: requests: storage: 5Gi --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: agent-zero-knowledge namespace: agent-zero spec: accessModes: [ReadWriteOnce] storageClassName: longhorn resources: requests: storage: 1Gi # ============================================================================= # RBAC — Give Agent Zero kubectl access to the cluster # ============================================================================= --- apiVersion: v1 kind: ServiceAccount metadata: name: agent-zero namespace: agent-zero --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: agent-zero-cluster-admin roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: agent-zero namespace: agent-zero # ============================================================================= # Agent Zero — AI Agent Web UI (NUC Edition, Blue Jay Profile) # ============================================================================= # Connects directly to fc-llm-bridge for chat + internal util/embed + browser. # Agent Zero's internal util/embed slots stay on the bridge's OpenAI-compatible # /v1 surface, while browser + corpus-search use the Ollama-compatible /api/* # surface through OLLAMA_HOST. # Blue Jay profile with 21 tools, 3 prompts, 4 extensions. --- # FC LLM Bridge API key for Agent Zero (ADR-088 chat/util/embed/browser routing). # Syncs from 1Password item "FC LLM Bridge API Keys" (field: agent-zero-k8s). # Consumed by chat, internal util/embed, browser, and corpus-search requests # that traverse fc-llm-bridge. apiVersion: onepassword.com/v1 kind: OnePasswordItem metadata: name: fc-llm-bridge-api-keys namespace: agent-zero spec: itemPath: "vaults/IAmWorkin/items/FC LLM Bridge API Keys" --- # Print.Web API key for Agent Zero's print_web.py Python tool. # Syncs from 1Password item "Print.Web API Keys" (password field = API key). # The print_web.py tool reads PRINT_WEB_API_KEY env var for all HTTP requests # to the thermal print service (GET /api/mcp/tools, POST /api/print/*, etc.). # Note: Print.Web uses the legacy REST MCP shape (/api/mcp/tools/*), not the # streamable-http MCP protocol. The print_web Python tool bridges this gap # and is already present in bluejay-tools ConfigMaps. apiVersion: onepassword.com/v1 kind: OnePasswordItem metadata: name: print-web-api-keys namespace: agent-zero spec: itemPath: "vaults/IAmWorkin/items/Print.Web API Keys" --- apiVersion: apps/v1 kind: Deployment metadata: name: agent-zero namespace: agent-zero labels: app: agent-zero annotations: agent-zero/deployment: "nuc" agent-zero/profile: "bluejay" agent-zero/ollama: "fc-llm-bridge fronts edge1 Pi 5 + AI HAT+ Ollama for cluster browser/corpus-search traffic; internal chat/util/embed route through the bridge's authenticated OpenAI surface" spec: replicas: 1 selector: matchLabels: app: agent-zero strategy: type: Recreate template: metadata: labels: app: agent-zero spec: serviceAccountName: agent-zero initContainers: # Wait for fc-llm-bridge to be reachable before starting Agent Zero. - name: wait-for-llm-bridge image: busybox:1.37 command: ["sh", "-c"] args: - | echo "Waiting for fc-llm-bridge..." until wget -qO- --timeout=2 http://fc-llm-bridge.fc-llm-bridge.svc:8080/healthz >/dev/null 2>&1; do echo "fc-llm-bridge not ready yet, retrying in 5s..." sleep 5 done echo "fc-llm-bridge is reachable." # Assemble the Blue Jay profile directory structure from ConfigMaps. # ConfigMaps can't create nested dirs, so we copy into the workspace PVC. - name: setup-bluejay image: busybox:1.37 command: ["sh", "-c"] args: - | echo "Setting up Blue Jay profile..." # Profile root files mkdir -p /a0/work/.bluejay/agents/bluejay/tools mkdir -p /a0/work/.bluejay/agents/bluejay/prompts cp /tmp/bluejay-profile/* /a0/work/.bluejay/agents/bluejay/ # Tools (split across 3 ConfigMaps to stay under K8s 262K annotation limit) cp /tmp/bluejay-tools-a/* /a0/work/.bluejay/agents/bluejay/tools/ cp /tmp/bluejay-tools-b/* /a0/work/.bluejay/agents/bluejay/tools/ cp /tmp/bluejay-tools-c/* /a0/work/.bluejay/agents/bluejay/tools/ # Prompts cp /tmp/bluejay-prompts/* /a0/work/.bluejay/agents/bluejay/prompts/ # Extensions mkdir -p /a0/work/.bluejay/extensions/flowercore cp /tmp/flowercore-extensions/* /a0/work/.bluejay/extensions/flowercore/ # Theme mkdir -p /a0/work/.bluejay/theme cp /tmp/bluejay-theme/* /a0/work/.bluejay/theme/ echo "Blue Jay profile ready:" echo " Tools: $(ls /a0/work/.bluejay/agents/bluejay/tools/*.py | wc -l)" echo " Prompts: $(ls /a0/work/.bluejay/agents/bluejay/prompts/*.md | wc -l)" echo " Extensions: $(ls /a0/work/.bluejay/extensions/flowercore/*.py | wc -l)" volumeMounts: - name: workspace mountPath: /a0/work - name: bluejay-tools-a mountPath: /tmp/bluejay-tools-a - name: bluejay-tools-b mountPath: /tmp/bluejay-tools-b - name: bluejay-tools-c mountPath: /tmp/bluejay-tools-c - name: bluejay-profile mountPath: /tmp/bluejay-profile - name: bluejay-prompts mountPath: /tmp/bluejay-prompts - name: flowercore-extensions mountPath: /tmp/flowercore-extensions - name: bluejay-theme mountPath: /tmp/bluejay-theme containers: - name: agent-zero image: agent0ai/agent-zero:latest command: ["/bin/bash", "-c"] args: - | # Install kubectl if not cached if [ -f /a0/work/kubectl ]; then cp /a0/work/kubectl /usr/local/bin/kubectl else curl -sLO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl" && \ chmod +x kubectl && mv kubectl /usr/local/bin/kubectl && \ cp /usr/local/bin/kubectl /a0/work/kubectl fi # Link Blue Jay profile from workspace into Agent Zero's expected path ln -sfn /a0/work/.bluejay/agents/bluejay /a0/agents/bluejay # Write model config BEFORE initialize.sh loads it # The _model_config plugin reads config.json (NOT config.yaml). # chat_model: FlowerCore LLM Bridge (ADR-088) — OpenAI-compat, # spend-tracked, tier-aliased (fc:balanced → Claude Sonnet). # api_key comes from A0_SET_chat_model_api_key env var (overrides # config.json). Utility + embedding stay on the authenticated # OpenAI-compatible /v1 surface; browser and direct tool traffic # use the bridge's Ollama-compatible root via OLLAMA_HOST. mkdir -p /a0/usr/plugins/_model_config cat > /a0/usr/plugins/_model_config/config.json << 'MODELCFG' {"allow_chat_override":true,"chat_model":{"provider":"openai","name":"fc:balanced","api_base":"http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1","ctx_length":8192,"ctx_history":0.7,"vision":false,"kwargs":{"temperature":0,"num_ctx":8192}},"utility_model":{"provider":"openai","name":"fc:cheap","api_base":"http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1","ctx_length":8192,"ctx_input":0.7,"kwargs":{"num_ctx":8192}},"embedding_model":{"provider":"openai","name":"openai/fc:embedding","api_base":"http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1","kwargs":{}}} MODELCFG # Strip heredoc indentation sed -i 's/^ //' /a0/usr/plugins/_model_config/config.json # Phase 0 Chat MCP pilot: Agent Zero does not interpolate env vars # inside A0_SET_mcp_servers JSON, so build the final JSON here from # the secret-backed CHAT_MCP_API_KEY env var before initialize.sh. # Use the in-cluster Chat service URL rather than the public # Traefik hostname so the pod stays off the private VIP lane that # the default egress rule blocks. if [ -n "${CHAT_MCP_API_KEY:-}" ]; then export A0_SET_mcp_servers="{\"mcpServers\":{\"fc-chat\":{\"type\":\"streamable-http\",\"url\":\"http://chat-web.fc-chat.svc/mcp\",\"headers\":{\"X-Api-Key\":\"${CHAT_MCP_API_KEY}\"}}}}" fi # Run the original entrypoint exec /exe/initialize.sh $BRANCH ports: - containerPort: 80 env: # Agent identity - name: AGENT_NAME value: "Blue Jay (NUC)" # Chat model — routed through FlowerCore LLM Bridge (ADR-088) # so spend is tracked and tier aliases (fc:cheap/fc:balanced/fc:deep) # dispatch to Ollama or Anthropic via a single OpenAI-compat endpoint. # Internal utility + embedding use the authenticated OpenAI surface, # while browser/corpus-search use the bridge's Ollama-compatible # endpoints so Agent Zero no longer needs a local proxy sidecar. - name: A0_SET_chat_model_provider value: "openai" - name: A0_SET_chat_model_name value: "fc:balanced" - name: A0_SET_chat_model_api_base value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1" - name: A0_SET_chat_model_api_key valueFrom: secretKeyRef: name: fc-llm-bridge-api-keys key: agent-zero-k8s # Agent Zero's runtime still resolves provider keys from the # provider-level env names (models.get_api_key -> OPENAI_API_KEY / # API_KEY_OPENAI), not the slot-scoped A0_SET_* value alone. # Mirror the same secret here so real public chat runs can reach # the fc-llm-bridge chat_model path instead of failing before MCP. - name: OPENAI_API_KEY valueFrom: secretKeyRef: name: fc-llm-bridge-api-keys key: agent-zero-k8s - name: FC_LLM_BRIDGE_API_KEY valueFrom: secretKeyRef: name: fc-llm-bridge-api-keys key: agent-zero-k8s - name: A0_SET_chat_model_ctx_length value: "8192" - name: A0_SET_chat_model_kwargs value: '{"temperature": 0, "num_ctx": 8192}' # Utility model — fast small helper tier through the OpenAI surface - name: A0_SET_util_model_provider value: "openai" - name: A0_SET_util_model_name value: "fc:cheap" - name: A0_SET_util_model_api_base value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1" - name: A0_SET_util_model_kwargs value: '{"num_ctx": 2048}' # Embedding model — authenticated bridge alias to nomic-embed-text. # LiteLLM's embedding() path needs an explicit provider prefix here # even though the chat slot can use bare fc:* aliases. - name: A0_SET_embed_model_provider value: "openai" - name: A0_SET_embed_model_name value: "openai/fc:embedding" - name: A0_SET_embed_model_api_base value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080/v1" # Browser model — small Gemma candidate through the same proxy - name: A0_SET_browser_model_provider value: "ollama" - name: A0_SET_browser_model_name value: "gemma3:4b" - name: A0_SET_browser_model_api_base value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080" - name: A0_SET_browser_model_api_key valueFrom: secretKeyRef: name: fc-llm-bridge-api-keys key: agent-zero-k8s - name: A0_SET_browser_model_vision value: "true" - name: OLLAMA_HOST value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080" - name: FLOWERCORE_AGENTZERO_OLLAMA_URL value: "http://fc-llm-bridge.fc-llm-bridge.svc:8080" # Agent profile — Blue Jay personality, tools, and system prompt - name: A0_SET_agent_profile value: "bluejay" # Memory settings - name: A0_SET_memory_memorize_enabled value: "true" - name: A0_SET_memory_memorize_consolidation value: "true" - name: A0_SET_memory_memorize_replace_threshold value: "0.85" - name: A0_SET_memory_recall_enabled value: "true" # Speech-to-text disabled (no GPU for Whisper) - name: A0_SET_stt_model_size value: "tiny" # FlowerCore.Chat MCP pilot (Phase 0) - name: CHAT_MCP_API_KEY valueFrom: secretKeyRef: name: chat-mcp-api-key key: api-key optional: true # Print.Web — Thermal printer service on edge2. # PRINT_WEB_URL: internal HTTP (bypasses Traefik TLS — print_web.py # runs in-cluster and can reach edge2 directly on the PROD VLAN). # PRINT_WEB_API_KEY: from 1Password "Print.Web API Keys" password field, # synced by the print-web-api-keys OnePasswordItem CRD above. # The print_web.py Python tool reads both env vars for all HTTP calls. - name: PRINT_WEB_URL value: "http://10.0.57.16:5200" - name: PRINT_WEB_API_KEY valueFrom: secretKeyRef: name: print-web-api-keys key: password # Intranet search — use in-cluster HTTP (no step-ca TLS needed) # corpus_search.py reads FLOWERCORE_FLEET_VECTOR_DIR but that mount is not # on the cluster yet (BLUEJAY-WS only). The tool gracefully returns a # "no DB found" message with rebuild instructions rather than crashing. - name: FLOWERCORE_INTRANET_URL value: "http://intranet-web.intranet.svc:5300" # Kubernetes - name: KUBERNETES_SERVICE_HOST value: "kubernetes.default.svc" - name: KUBERNETES_SERVICE_PORT value: "443" volumeMounts: - name: workspace mountPath: /a0/work - name: knowledge mountPath: /a0/knowledge/custom/main - name: flowercore-extensions mountPath: /a0/extensions/flowercore readOnly: true - name: bluejay-theme mountPath: /a0/webui/static/css/custom readOnly: true startupProbe: httpGet: path: / port: 80 initialDelaySeconds: 15 periodSeconds: 10 failureThreshold: 18 livenessProbe: httpGet: path: / port: 80 periodSeconds: 30 failureThreshold: 3 readinessProbe: exec: command: - /bin/bash - -c - "curl -sf http://localhost:80/ > /dev/null && curl -sf --connect-timeout 3 http://fc-llm-bridge.fc-llm-bridge.svc:8080/healthz > /dev/null" periodSeconds: 30 failureThreshold: 2 resources: requests: memory: "2Gi" cpu: "1000m" limits: memory: "3Gi" cpu: "2000m" volumes: - name: workspace persistentVolumeClaim: claimName: agent-zero-data - name: knowledge persistentVolumeClaim: claimName: agent-zero-knowledge - name: bluejay-tools-a configMap: name: bluejay-tools-a - name: bluejay-tools-b configMap: name: bluejay-tools-b - name: bluejay-tools-c configMap: name: bluejay-tools-c - name: bluejay-profile configMap: name: bluejay-profile - name: bluejay-prompts configMap: name: bluejay-prompts - name: flowercore-extensions configMap: name: flowercore-extensions - name: bluejay-theme configMap: name: bluejay-theme --- apiVersion: v1 kind: Service metadata: name: agent-zero namespace: agent-zero spec: type: ClusterIP selector: app: agent-zero ports: - port: 80 targetPort: 80 # ============================================================================= # Traefik IngressRoute — LAN access at agent-zero.iamworkin.lan # ============================================================================= --- apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: name: agent-zero namespace: agent-zero spec: entryPoints: - websecure routes: - match: Host(`agent-zero.iamworkin.lan`) kind: Rule services: - name: agent-zero port: 80 tls: secretName: agent-zero-tls # ============================================================================= # TLS Certificate via cert-manager (step-ca ACME) # ============================================================================= --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: agent-zero-tls namespace: agent-zero spec: secretName: agent-zero-tls issuerRef: name: step-ca-acme kind: ClusterIssuer dnsNames: - agent-zero.iamworkin.lan duration: 720h renewBefore: 240h # ============================================================================= # NetworkPolicy — Restrict traffic # ============================================================================= --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: agent-zero-netpol namespace: agent-zero spec: podSelector: matchLabels: app: agent-zero policyTypes: - Ingress - Egress ingress: # Allow from Traefik - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: traefik-system ports: - port: 80 # Allow from monitoring (blackbox probe) - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: monitoring ports: - port: 80 egress: # DNS - to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: kube-system ports: - port: 53 protocol: UDP - port: 53 protocol: TCP # Print.Web on edge2 - to: - ipBlock: cidr: 10.0.57.16/32 ports: - port: 5200 # K8s API - to: - ipBlock: cidr: 10.0.56.11/32 ports: - port: 6443 # FlowerCore LLM Bridge (ADR-088 chat_model routing) — ClusterIP service # in the fc-llm-bridge namespace on port 8080. - to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: fc-llm-bridge ports: - port: 8080 protocol: TCP # FlowerCore.Chat MCP (Phase 0 pilot) — use the in-cluster chat-web # service instead of the public Traefik VIP so MCP traffic stays inside # the cluster and survives the private-range egress denylist. - to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: fc-chat ports: - port: 80 protocol: TCP - port: 8080 protocol: TCP # Intranet search API — use in-cluster svc so traffic stays inside # the cluster and is not blocked by the private-range egress denylist. - to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: intranet ports: - port: 5300 protocol: TCP # Allow internet (for kubectl image pull, etc) - to: - ipBlock: cidr: 0.0.0.0/0 except: - 10.0.0.0/8 - 172.16.0.0/12 - 192.168.0.0/16