Skip to content

Configuration

Karakuri is configured by two things: - config.yaml — non-secret settings (mounted read-only) - .env / environment variables — secrets

Environment variables (.env)

Variable Required Purpose
SLACK_BOT_TOKEN yes Slack bot token (xoxb-…)
SLACK_APP_TOKEN yes Slack app-level token for Socket Mode (xapp-…)
BUTTON_SIGNING_SECRET yes HMAC secret for signing interactive button payloads (32-byte hex)
OPENROUTER_API_KEY if provider=openrouter OpenRouter key
GROQ_API_KEY if provider=groq Groq key
OPENAI_API_KEY if provider=openai OpenAI key
ANTHROPIC_API_KEY if provider=anthropic Anthropic (Claude) key
AWS_REGION if provider=bedrock (or set llm.region) Bedrock region; auth via AWS credential chain / IRSA
POSTGRES_DSN if backend=postgres postgresql://user:pass@host:5432/db
PROMETHEUS_TOKEN if prometheus.bearer_token_env names it Bearer token for the PromQL alerting queries
PROMETHEUS_PASSWORD if prometheus.basic_auth_password_env names it Basic-auth password for the same
CONFIG_PATH no Path to config.yaml (default /app/config.yaml)
KUBECONFIG no Path to kubeconfig inside the container
METRICS_PORT no Prometheus exporter port (default 9090; Helm sets it from metrics.port)
STARTUP_BASELINE_SECONDS no Post-restart alert-storm suppression window (default 300); pre-existing problems detected in this window fold into one summary instead of a card each in the channel; the ones still open when it closes get their cards in the summary's thread (up to 20)

Only the key for the selected provider is needed.

config.yaml reference

slack:
  audit_channel: "#devops-audit"      # every executed command is logged here
  allowed_users: []                    # Slack user IDs allowed to Apply fixes
  allowed_channels: ["#devops-bot"]    # channels Karakuri listens in for @mentions
                                       # AND where card buttons may be clicked;
                                       # accepts "name", "#name" or a channel ID,
                                       # in public and private channels alike

llm:
  provider: openrouter                 # groq | openrouter | openai
  model: google/gemini-2.0-flash-lite  # provider-specific model id
  temperature: 0.2
  max_tokens: 1024

agent:
  backend: sqlite                      # sqlite | postgres
  checkpoint_db: /app/data/agent.db    # LangGraph checkpointer (sqlite only)
  outcomes_db: /app/data/outcomes.db   # learning-loop store (sqlite only)

clusters:
  dev:                                 # arbitrary cluster key — add a block per cluster
    context: kind-dev                  # name from `kubectl config get-contexts`
    notify_channel: "#devops-dev-alerts"  # where cards are posted; allow-list it in
                                       # slack.allowed_channels (or put the operators
                                       # in slack.allowed_users) or the buttons on
                                       # those cards refuse every click
    auto_watch: true                   # watch this cluster
    k8sgpt: false                      # also consume k8sgpt Result CRs on this cluster

watcher:
  dedup_ttl_seconds: 3600              # finding dedup window
  log_tail_lines: 200                  # --tail for diagnosis logs
  events_limit: 50
  ignore_namespaces: [kube-system, kube-public, kube-node-lease]
  ingress_ignore_backends: [ssl-redirect]   # ingress backends to treat as phantom (skip)
  rate_limit_per_pod_per_hour: 3       # cap diagnoses per pod
  confidence_floor_for_apply_button: 0.5  # hide Apply if LLM confidence is lower
  backoff_initial_seconds: 5           # watcher reconnect backoff
  backoff_max_seconds: 300
  # Native resource analyzers (real-time, no external tool) — all on by default:
  check_service_endpoints: true        # Service with no ready endpoints
  service_endpoints_grace_seconds: 90  # debounce (ignore rollouts)
  check_pvc_pending: true              # PVC unbound (Pending/Lost)
  check_ingress: true                  # Ingress backend Service missing
  check_nodes: true                    # Node NotReady
  check_hpa: true                      # HPA can't scale (ScalingActive=False)
  hpa_grace_seconds: 120               # debounce first: a pod that has just started
                                       # has no metrics sample, so a rollout or restart
                                       # briefly reports FailedGetResourceMetric
  check_rollout: true                  # Deployment rollout stalled (ProgressDeadlineExceeded)
  check_pod_conditions: true           # Pod Running-but-not-Ready / stuck Terminating
  check_jobs: true                     # Job/CronJob: one card when the Job is marked Failed
                                       # (per CronJob, closed by its next successful run).
                                       # Failed attempts, restarts and Unschedulable pods of
                                       # a Job post nothing; a bad image or missing Secret
                                       # still alerts. false restores per-pod alerts.
                                       # Mute one CronJob/Job with the annotation
                                       # karakuri.clouddrove.com/ignore: "true" (usage.md).
  pod_conditions_grace_seconds: 180    # debounce before alerting
  pod_conditions_resolve_grace_seconds: 300  # how long a pod must stay healthy
                                       # before the card is resolved. Longer than the
                                       # detection grace on purpose: a crashlooping pod
                                       # is Ready for seconds between restarts, and a
                                       # premature green card is worse than a late one.
  stale_card_max_age_seconds: 604800   # an open card nobody acted on for a week is
                                       # backlog, not a live incident — stop tracking it
                                       # (the watchers re-alert if it still holds). 0 = off
  resolve_channel_message: true        # post a resolution card in the notify
                                       # channel too, not only in the alert thread
  resolve_post_new_card: false         # make that a full second card (incident line
                                       # + how it cleared) instead of a short note
  notify_on_workload_delete: false     # post a plain one-line note when a workload is
                                       # deleted. Off by default: a delete is normally
                                       # intentional, so there is no diagnosis, no card
                                       # and no Apply button. Deletes in ignore_namespaces
                                       # are skipped, so are deletes that come with a
                                       # namespace teardown (kubectl delete ns, helm
                                       # uninstall), and deletes inside one window
                                       # collapse into "N workloads deleted in <ns>".
                                       # A delete whose workload has a card is posted
                                       # in that card's thread; only a delete with no
                                       # card left to explain it reaches the channel.
                                       # The watch carries no actor, so the note cannot
                                       # say who did it. Needs check_rollout: true, the
                                       # watcher that streams Deployments.
  workload_delete_kinds:               # kinds the note covers. Deployment rides the
    [Deployment, StatefulSet,          # rollout watcher; StatefulSet and DaemonSet
     DaemonSet]                        # have a delete-only watcher, which also closes
                                       # their cards when the workload goes away,
                                       # notices on or off. A kind nothing streams is
                                       # still refused at load rather than sitting
                                       # there doing nothing.
  burst_threshold: 3                   # this many incidents on one cluster inside
                                       # burst_window_seconds post ONE parent message
                                       # and thread the incident cards under it, so a
                                       # bad deploy touching several workloads is one
                                       # entry in the channel instead of seven cards.
                                       # Below the threshold nothing changes: a lone
                                       # alert stays a top-level card. Each incident is
                                       # still its own message, so Apply, Investigate,
                                       # per-card resolve and permalinks are unchanged,
                                       # and a resolution note goes to the burst thread
                                       # rather than back to the channel. A Node
                                       # incident always keeps its own top-level card.
                                       # 0 = off (keeps one card per incident)
  burst_window_seconds: 60             # the rolling window. A burst opens when the
                                       # threshold is met inside it and closes once the
                                       # window passes with no new incident; the next
                                       # incident starts a fresh window and a fresh
                                       # parent, never a reply on the closed one.
                                       # The same threshold and window apply to
                                       # resolutions: a run of them joins the open
                                       # burst thread, or gets its own "N incidents
                                       # resolved" parent, instead of one channel
                                       # message each.
  deep_investigation: false            # multi-step ReAct RCA (more LLM calls, deeper)
  deep_investigation_max_steps: 6

rate_limit:                            # per-user button/mention token bucket
  capacity: 5
  refill_per_minute: 10

k8sgpt:                                # optional — extra breadth via k8sgpt operator
  enabled: false                       # master switch; also set cluster.k8sgpt: true
  confidence_floor: 0.5
  max_findings: 25                     # anti-storm cap per scan
  group: core.k8sgpt.ai                # CRD coordinates (alpha API)
  version: v1alpha1
  plural: results

prometheus:                            # optional: app-level alerting via PromQL rules
  enabled: false                       # off by default; inert without url + rules
  url: ""                              # http://prometheus-server.monitoring.svc:80
  interval_seconds: 60                 # evaluation period for the whole rule set
  timeout_seconds: 10                  # per-query HTTP timeout
  bearer_token_env: ""                 # env var NAME holding the token (e.g. PROMETHEUS_TOKEN)
  basic_auth_user: ""
  basic_auth_password_env: ""          # env var NAME holding the password
  ca_bundle: ""                        # path to a CA bundle for TLS verification
  insecure_skip_verify: false
  default_cluster: ""                  # cluster for results with no `cluster` label
  rules:
    - name: high-error-rate            # stable id: dedup key + card source label
      summary: "5xx error rate above 5%"   # human label on the card
      description: "Check the last deploy, upstream dependencies, and error logs."
      severity: critical
      query: |
        sum by (namespace, deployment) (rate(http_requests_total{status=~"5.."}[5m]))
          / sum by (namespace, deployment) (rate(http_requests_total[5m]))
      threshold: 0.05
      comparison: gt                   # gt | gte | lt | lte
      for_seconds: 300                 # sustained breach before a card is posted
      resolve_after_seconds: 600       # sustained recovery before the card closes
      # kind: ""                       # force the finding kind (splits the dedup key)
      # cluster: ""                    # pin the rule to one cluster
      # namespace_label: namespace     # label holding the namespace
      # name_label: ""                 # label holding the resource name

guardrails:                            # kubectl execution policy — omit for safe defaults
  dangerous_verbs: [exec, cp, port-forward, proxy, attach]  # blocked outright (replaces default if set)
  extra_denied_verbs: []               # MERGED on top, e.g. [drain, cordon, taint]
  block_secret_reads: true             # deny get/describe of Secrets
  block_namespace_delete: true         # deny delete of Namespaces
  require_namespace_for_writes: true   # write verbs must pass -n <ns>

Notes

  • allowed_users uses Slack user IDs (e.g. U12345), not display names.
  • confidence_floor_for_apply_button — when the LLM's confidence is below this, the card shows Skip/Investigate only (no one-click Apply).
  • Switching provider/model: edit config.yaml and recreate the container — the file is volume-mounted, no image rebuild needed:
    docker compose up -d --force-recreate agent
    
  • Backends: sqlite is single-pod and simplest; postgres is multi-pod safe and requires POSTGRES_DSN. See Deployment.
  • Multiple clusters: add a block per cluster under clusters:. Each context must be reachable from inside the container (merge kubeconfigs into KUBECONFIG, and use static/token auth — cloud exec-plugins like gke-gcloud-auth-plugin won't run in the container). See Setup → multiple clusters.
  • Native analyzers (watcher.check_*) are real-time and need nothing in the cluster but Karakuri. Turn one off if it's noisy on a given cluster.
  • App-level alerting (optional): latency spikes, error-rate jumps and memory leaks never show up in container status, so prometheus.rules covers them with PromQL. Karakuri evaluates the queries itself on interval_seconds, with no alerting rules in Prometheus and no Alertmanager routing needed. A breach held for for_seconds posts the same approval-gated card as a native finding, and a recovery held for resolve_after_seconds closes it. The card subject is read from the result labels (namespace plus the first of pod / deployment / statefulset / daemonset / job), so keep those in the query's by() clause; a query with no workload labels files the card under the rule name. Off unless both url and at least one rule are set. This is independent of the Alertmanager webhook receiver: run either, both, or neither.
  • Prometheus credentials: only env var names go in config.yaml (bearer_token_env, basic_auth_password_env); the values come from the Secret (secrets.prometheusToken / secrets.prometheusPassword in the chart, or PROMETHEUS_TOKEN / PROMETHEUS_PASSWORD keys in your existingSecret). The token is never logged. For a private CA set ca_bundle to a mounted bundle path. With networkPolicy.enabled: true, add the Prometheus port to networkPolicy.extraEgressPorts (e.g. [9090]) or the queries are blocked.
  • k8sgpt (optional): for extra breadth, install the k8sgpt-operator in a cluster, set k8sgpt.enabled: true and that cluster's k8sgpt: true. Findings flow into the same approval-gated cards. Not required — the native analyzers cover the common cases.