Skip to content

Deployment

Docker Compose (single host)

docker compose up -d --build
docker compose logs -f agent

The bundled compose also starts a Postgres service for the postgres backend.

To run the published image instead of building locally, point the agent service at the GHCR image:

# docker-compose.yml
services:
  agent:
    image: ghcr.io/clouddrove/karakuri:latest
    # build: .

The image is private — docker login ghcr.io with a token that has read:packages first.

Helm on Kubernetes

helm install karakuri ./charts/karakuri \
  --namespace karakuri --create-namespace \
  --set image.repository=ghcr.io/clouddrove/karakuri \
  --set secrets.slackBotToken="xoxb-..." \
  --set secrets.slackAppToken="xapp-..." \
  --set secrets.openrouterApiKey="sk-or-..." \
  --set secrets.buttonSigningSecret="$(python3 -c 'import secrets;print(secrets.token_hex(32))')" \
  --set-json 'config.clusters={"prod":{"context":"in-cluster","notify_channel":"#prod-alerts","auto_watch":true}}'

For production, don't pass secrets via --set — create a Secret and use --set existingSecret=my-secret. See charts/karakuri/README.md.

Single active instance

Karakuri keeps watcher/alert state in memory, so it runs as one active replica. replicaCount must be 1 — the chart refuses to render otherwise, because two watchers double-post alerts. Deploys use the Recreate strategy so an upgrade never briefly runs two pods (brief downtime on upgrade is expected). Active/active HA would require moving that state to a shared store and is not yet supported (see the HA design for the concrete plan); for fast recovery, rely on the Kubernetes Deployment restarting the pod plus the KarakuriDown alert.

Useful chart values

Value Purpose
persistence.enabled / persistence.size PVC for the SQLite backend
config.agent.backend=postgres + secrets.postgresDsn Postgres backend
metrics.serviceMonitor.enabled Prometheus Operator scraping
metrics.prometheusRule.enabled Alerts incl. KarakuriDown dead-man's switch
networkPolicy.enabled Restrict egress (DNS, Slack, provider, kube-apiserver, Postgres)
existingSecret Use a pre-created Secret instead of --set tokens
config.k8sgpt.enabled Consume k8sgpt-operator Result CRs as a detection source — auto-adds RBAC (get/list/watch on the configured group/plural). Requires k8sgpt-operator installed.

EKS (IRSA) / GKE (Workload Identity) annotation examples are in charts/karakuri/README.md.

CI / image publishing

main is built by GitHub Actions (.github/workflows/ci.yml): gitleaks → unit tests → helm lint, then publishes a single ghcr.io/clouddrove/karakuri:latest image on push to main.

Local kind cluster

kind create cluster --name dev
# macOS/Windows: rewrite the kind server so the container can reach the host
kind get kubeconfig --name dev \
  | sed 's#https://127.0.0.1:#https://host.docker.internal:#' \
  > ~/.kube/kind-dev-config

On Linux, add network_mode: host to the agent service instead.

Persistence backends

  • sqlite (default) — single-pod, persists in the agent-data volume / PVC
  • postgres — multi-pod safe, requires POSTGRES_DSN

Switch via config.agent.backend and recreate.

Observability

Prometheus metrics on :9090/metrics. Key series:

  • karakuri_diagnosis_result_total{cluster,action} — posted / applied / regressed / muted / dryrun_failed / skipped / error
  • karakuri_restart_detected_total{cluster,namespace,reason}
  • karakuri_tool_calls_total{cluster,verb,exit}
  • karakuri_guardrail_denied_total{rule}
  • karakuri_llm_requests_total{op}
  • karakuri_rate_limited_total{surface}
  • karakuri_mention_latency_seconds, karakuri_diagnose_latency_seconds (histograms)

Enable metrics.prometheusRule.enabled for the KarakuriDown dead-man's switch (alerts if the agent stops being scraped) and a diagnosis-error alert.