Kubernetes operations guide

Kubernetes auto-remediation needs a brake pedal.

Useful Kubernetes automation combines evidence-driven diagnosis, a code-enforced action policy, human approval for meaningful risk, and verification after every change.

By Hadi Farnoud · Last reviewed: July 16, 2026

What Kubernetes auto-remediation should do

Auto-remediation closes the gap between detecting a known failure mode and restoring a healthy state. It should gather current evidence, identify a bounded corrective action, enforce policy outside the AI model, execute only within that policy, and verify the result. It should not turn an uncertain diagnosis into an irreversible command. When state, ownership, or blast radius is unclear, escalation is the correct automated outcome.

Kubernetes already performs control-loop remediation: Deployments replace failed replicas, kubelet restarts containers according to restart policy, and Services stop routing to unready pods. An additional remediation tool should complement those controllers. It should act only when the platform's normal self-healing has insufficient context, has reached a failure loop, or needs a decision that Kubernetes cannot safely infer.

A three-tier action model

Safe

Read-only investigation and explicitly allowed, bounded operations. Every write still needs a known target, a narrow scope, and an observable recovery condition.

Risky

Changes with a meaningful blast radius. Rollbacks, manifest edits, scale-downs, and similar operations should wait for explicit approval.

Unsupported

Destructive cluster-wide operations and commands outside the product's tool surface are not exposed for execution, regardless of what a model proposes.

The model proposes; code decides. An allowlist remains stable across prompts, model versions, and untrusted text found in logs or resource annotations.

The remediation lifecycle

  1. Detect: identify a concrete unhealthy condition rather than a vague anomaly.
  2. Diagnose: gather logs, events, resource state, rollout history, probes, limits, and known service context.
  3. Plan: propose the smallest action that addresses the likely cause.
  4. Classify: validate the proposed tool and arguments, then map the action to a code-defined safety tier.
  5. Execute or request approval: preserve the target, exact action, evidence, and rationale for review.
  6. Verify: check readiness, events, restarts, rollout state, and application behavior after execution.
  7. Record: preserve the cause, action, approval, and outcome for future incidents.

Design the guardrails before the automation

Begin with identity and scope. Run with the smallest Kubernetes permissions needed for the namespaces and resource kinds in scope. Separate read permissions from write permissions, and test the denial path. A model response must never become an arbitrary shell command. Parse it into a typed action, validate every argument, reject unknown tools, and apply policy in ordinary code.

Then define operational limits: one active remediation per incident, a maximum retry count, a cooldown after writes, and a deadline for verification. Use idempotency keys or state checks so a repeated notification cannot execute the same mutation twice. If another operator or controller changes the resource during diagnosis, gather fresh evidence and require a new decision rather than applying a stale plan.

Finally, make stopping easy. Operators need an immediate way to pause automation globally or for a workload, and a safe default when the notification provider, model provider, or audit sink is unavailable. A failed dependency should degrade to evidence collection and escalation—not silently broaden permission or repeat writes.

Where automation fits

ScenarioRecommended handlingReason
Known stateless failure with bounded recoveryPolicy-approved actionLow blast radius and clear verification
Rollback, scale-down, or configuration mutationHuman approvalA correct diagnosis may still produce business impact
Namespace, node, RBAC, or unknown commandReject or escalateOutside the supported safety contract
Novel stateful or security incidentEscalate with evidenceUncertainty is itself a reason not to act

Verification is part of the action

A successful API response is not recovery. Define success before executing: the rollout becomes available, readiness stabilizes, restart counts stop increasing, warning events cease, and a user-facing check succeeds. Wait long enough to observe the workload through its startup and readiness windows. If recovery cannot be confirmed, mark the attempt inconclusive or failed and escalate with the new evidence.

Do not loop indefinitely. Repeating the same action can amplify a bad diagnosis, exhaust capacity, or erase useful failure state. After the bounded attempt count, stop. The incident record should show what changed, who approved it, which checks ran, and whether the original symptom returned.

Questions for evaluating a remediation product

  • Can the model invoke arbitrary shell commands, or only typed tools with validated arguments?
  • Where is the action policy enforced, and can prompt content modify it?
  • Which writes run automatically, which require approval, and which are unsupported?
  • What Kubernetes identity is used, and how narrowly can permissions be scoped?
  • How are duplicate actions, stale diagnoses, conflicting controllers, timeouts, and failed verification handled?
  • Can an operator reconstruct the evidence, proposal, decision, action, and outcome afterward?

Sources and further reading

Continue reading