Skip to content

Usage

Two ways to interact: ask (@karakuri …) and react (the buttons on a proactive restart alert).

Ask — @karakuri in Slack

Mention the bot in any allowed channel. A ReAct agent runs kubectl across your configured clusters and answers in natural language.

@karakuri list clusters
@karakuri show pods in dev namespace default
@karakuri why is the api pod in prod restarting?
@karakuri get events for deploy/web in staging
@karakuri selftest

What it can do: - Reads (get / describe / logs / events) — allowed everywhere except Secrets - Writes (apply / delete / scale / rollout / set resources) — require an explicit namespace - Replies are posted in-thread; long output is formatted for Slack

What's open right now

@karakuri list issues
@karakuri open alerts
@karakuri status
@karakuri list issues on minikube
@karakuri list issues -n karakuri-test
@karakuri list issues kind=Pod

Answers from Karakuri's own tracked cards — every alert or finding that hasn't been resolved or skipped — rather than a fresh cluster scan, so it tells you what is still open rather than what a kubectl get would show. Each line carries the kind, namespace/name, the reason, the card's state (open · fix applied, verifying · regressed · needs a human) and its age, with a link to the card when one is available. Scoped to the clusters bound to the channel you ask from, so it can't surface another team's incidents.

A pod is listed as a Pod with its owning controller alongside it — *Pod*argocd/argo-updater-686745bw895w(Deployment argo-updater) — since the pod name is what you act on and the controller is what alerts dedup by.

Open cards that nobody acts on stop being tracked after a week (watcher.stale_card_max_age_seconds), so the list stays a live incident feed rather than a backlog. If the condition still holds, the watchers alert again.

status here is the incident list; @karakuri selftest is agent health.

What it will refuse (guardrails): - Reading Secrets - Deleting a namespace - Dangerous verbs: exec, cp, port-forward, proxy, attach - Writes without a namespace - Anything on a cluster not in your allowlist

React — proactive restart alerts

Karakuri watches every auto_watch cluster. When a pod restarts, it:

  1. Fetches --previous logs + events
  2. Asks the LLM for a root cause + a suggested kubectl fix
  3. Posts a Block Kit card to the cluster's notify_channel

The card has: - Apply fix — the button only appears for a command the API server has already accepted: the proposed fix is dry-run when the card is built, and a command it rejects (bad grammar, an immutable field, an admission webhook) is dropped with the reason on the card instead of shown as a button that fails on click. Clicking runs a second --dry-run=server preview (posted in-thread, since the cluster can change between posting and clicking), then the real command only if the preview passes. Only allowed_users may apply. - Skip — dismiss; recorded as an outcome - Investigate — posts container status, recent logs, and events in-thread - Run diagnostics — shown instead of Apply when there's no safe auto-fix. The LLM proposes 2-3 read-only kubectl probes (read-only enforced by guardrails); one click runs them and posts the output in-thread. The card stays as-is (no auto-apply) - Full report — runs read-only diagnostics and posts a structured incident report (issue, root cause, evidence, recommended permanent fix, verification) in the thread. - ⋯ overflow — Copy fix command, View raw logs in thread, Mute this pod 1h

Card lifecycle

A single card updates in place through its life:

  • 🚨 Detected → 🔧 Fix applied → ✅ Resolved (auto, after ~10 min with no new restarts)
  • 🔁 Regressed if the pod restarts again before resolving

Alerts are deduplicated by the owning controller (Deployment/StatefulSet/…), so pod-name churn from rollouts collapses into one card instead of spamming a new alert per pod.

How a card closes

Karakuri never closes a card on silence alone — a crashlooping pod goes quiet during kubelet backoff while still broken. Three closing states, each with its own wording on the card, in the thread and in the channel:

Card Meaning
✅ Resolved (verified healthy) The rollout converged / the pod is Ready. Health was checked
✅ Resolved (workload no longer present) The subject was deleted or never existed, so there is nothing left to check
✔️ Closed (unverified) The alert went quiet, the subject still exists, and health could not be confirmed (no context, policy denial). No fix was confirmed, so check it before assuming it recovered

The card keeps its identity when it closes: it collapses to one line that still carries the original reason and workload, plus the resolution time, for example ✅ CrashLoopBackOff karakuri-test/api · Resolved at 02:57 (verified healthy).

Because a Slack edit does not resurface in the channel, that collapse is easy to miss, so Karakuri also posts a short resolution card in the notify channel: a green (or grey, when unverified) bar, the close reason, and a link back to the original alert. It is posted once per resolution and reset when a card reopens, so a flapping workload does not spam the feed. Set watcher.resolve_channel_message: false for thread-only resolutions, or watcher.resolve_post_new_card: true to get a fuller second card that repeats the incident line and how it cleared.

If an Apply fix was attempted and never landed (dry-run aborted, or a non-zero exit), the resolve note says so explicitly: the workload recovered some other way, not because Karakuri fixed it.

Two kinds of resolution stay out of the channel. A workload no longer present close on a card nobody acted on (no applied fix, no re-proposal, no needs-human escalation) posts only its thread note and lets the card collapse: nothing was wrong, so there is nothing to narrate. And when several incidents resolve inside watcher.burst_window_seconds, the notes fold into one parent the way alerts do (the open burst thread if there is one, otherwise a "N incidents resolved" parent), instead of one channel message each.

Mute

The overflow Mute this pod 1h suppresses proactive alerts for that pod for an hour (in-memory; resets on agent restart).

Beyond pods — resource findings

Karakuri also runs native, real-time analyzers for non-pod resources, surfaced as the same approval-gated cards (labelled by kind):

  • Service with no endpoints (selector matches no ready pods)
  • PVC unbound (Pending/Lost)
  • Ingress whose backend Service doesn't exist
  • Node NotReady (usually needs a human — no auto-cordon)
  • HPA that can't scale (metrics broken) — finding is enriched with a live scan (metrics-server health, the target's missing resources.requests, metric types)
  • Deployment rollout stalled (ProgressDeadlineExceeded)
  • Pod Running-but-not-Ready (readiness) or stuck Terminating

The not-Ready check skips pods that are not meant to keep running: anything with a restartPolicy other than Always, and anything whose owner is not a long-running controller (Deployment, StatefulSet, DaemonSet, ReplicaSet, ReplicationController, or a Node for static pods). That covers Jobs, CronJobs and per-job CRDs such as Actions Runner Controller's EphemeralRunner, where sitting not-Ready waiting for work and then disappearing is normal life rather than an incident. A pod with no owner at all still alerts: nothing recreates it, so a bare pod applied by hand is one a human wants to hear about. A Job pod that genuinely gets stuck still surfaces, through the Job failure below. - Job / CronJob failed (check_jobs, on by default), see below

Jobs and CronJobs

Jobs alert only on failure. A card is posted when Kubernetes marks the Job itself Failed (BackoffLimitExceeded, DeadlineExceeded, a pod failure policy). Every run of one CronJob shares a single card, and the next successful run closes it; a standalone Job's card closes when the Job is deleted. A failed attempt that the Job retries, container restarts inside a Job and Unschedulable Job pods post nothing, since the Job may still succeed. Container errors that make a Job hang rather than fail (a bad image, a missing Secret or ConfigMap) still alert, because the Job would never report them. With k8sgpt on, a suspended CronJob is not reported.

What you see What to do
Too many cards for one CronJob or Job, and you never want to hear about it Annotate it karakuri.clouddrove.com/ignore: "true" (below)
A whole namespace of batch work you do not own Add the namespace to watcher.ignore_namespaces
You want the old behaviour: a card per failed or restarted Job pod watcher.check_jobs: false

Excluding one CronJob or Job. Add the annotation to the object's own metadata, in the manifest or Helm chart the team already owns. No Karakuri change or restart is needed:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: nightly-report
  annotations:
    karakuri.clouddrove.com/ignore: "true"   # "true", "yes" or "1"
spec:
  ...

Or on a live object:

kubectl -n <namespace> annotate cronjob <name> karakuri.clouddrove.com/ignore=true
# undo
kubectl -n <namespace> annotate cronjob <name> karakuri.clouddrove.com/ignore-

The same annotation works on a standalone Job. It mutes everything about that CronJob: its Job failures, and its pods' image, config, restart and scheduling alerts. Put it on the CronJob's own metadata, not only in jobTemplate: Kubernetes does not copy a CronJob's annotations to its Jobs, so Karakuri looks up the chain itself (pod, then Job, then CronJob). It caches the answer for a minute, so a newly added or removed annotation takes effect within about a minute. Adding it while a card is open closes the card on the next check, and removing it makes the next failure alert again. If Karakuri cannot read the CronJob (RBAC, API error) it alerts rather than staying quiet.

These auto-resolve when the issue clears. Toggle each via watcher.check_* in config. Most close within seconds of the fix; the Ingress card closes on the watcher's next re-LIST, so allow up to ten minutes after the backend Service is created.

Deeper RCA (opt-in)

By default diagnosis is single-shot. Set watcher.deep_investigation: true for a multi-step ReAct investigation: the agent runs its own read kubectl (get/describe/ logs/events) across the pod, controller, and related resources before concluding. Deeper root-cause analysis at the cost of more LLM calls. The flag covers both the first diagnosis and the automatic re-investigation that runs after a fix did not resolve an incident.

The investigation is bounded by watcher.deep_investigation_max_steps. When it runs out of steps before concluding, the agent logs one line and falls back to a single-shot diagnosis, carrying the evidence it already gathered into that prompt.

Learning loop

Every apply / skip outcome is recorded. The top-3 similar past outcomes are injected into future diagnoses, so fixes that worked before are preferred.

Health check

@karakuri selftest

Runs an import sanity check + cluster reach + LLM ping + Slack auth + backend + audit-channel write probe, and posts a pass/fail summary.

Audit trail

Every executed command is posted to slack.audit_channel: - successes are batched into a 5-minute digest - failures post immediately as red cards