The Cluster Doesn't Need to Be Visible: Kubernetes and Terraform Prompts That Audit Drift and Over-Permissioned RBAC Before Apply

Your cluster is not invisible to an LLM — and that myth is costing you reviews. The objection goes like this: "the model can't see the live state, can't run kubectl, so it can't help with infrastructure." But the model was never meant to touch the cluster. It is meant to read your manifests, your Terraform plan, your diff and your policy files — and tell you what a tired reviewer skips at 11 p.m. before a Friday apply.

Here is the working model I use: the LLM is a configuration reviewer and a check generator, not an operator. It never applies anything. It reads text you paste and answers a narrow question. Below are prompts for the three places where that pays off most: drift, RBAC, and a Helm release that fell over.

Terraform plan vs. live state: who is actually drifting

Drift is not "Terraform wants to change something." Drift is a resource whose real-world attributes no longer match the state file — someone edited a security group by hand, an autoscaler changed a count, a tag got rewritten by a console click. A plan shows ~ update in-place and most people nod it through. More on the topic: “Your Terraform Plan Is a Confession: How LLM Prompts Catch Drift, Force-New, and Delete-Before-Apply”.

Ask the model to separate intentional change from drift, and to name the attribute that moved.

Prompt:

You are reviewing a Terraform plan before apply. I paste the plan output below.

For every resource with an in-place update (~), classify it as:

(a) INTENDED — matches a change in my .tf files;

(b) DRIFT — the live value differs from state and no .tf change explains it;

(c) UNKNOWN — plan does not show enough.

For each, name the exact attribute, the old value, the new value, and what breaks

if we apply without reconciling. Flag any (replace) on a stateful resource

separately. Do not summarize resources with no changes.

Plan:

<paste plan>

A typical answer separates two tag changes and one desired_count bump as drift (someone scaled a service from the console), while the aws_iam_policy update is intended. That distinction is the whole game: intended changes go to apply, drift goes to a terraform import/refresh decision first. More on the topic: “Terraform & IaC: The Myths That Cost You Money and How Infrastructure as Code Actually Works”.

If your plan also contains force-new and destroy lines, this is a different read — the deletion line deserves its own prompt pass.

More on the topic: Your Terraform Plan Is Lying: Prompts That Read Drift, Force-New, and the Deletion Line Before Apply.

RBAC that grants more than the service will ever use

A ClusterRole with verbs: ["*"] on resources: ["*"] is the default copy-paste from half the tutorials on the internet. It works, nobody notices, and it means one compromised service account owns the cluster. More on the topic: “Before the Cluster Falls: LLM Prompts That Read Pods, Helm Charts, and Resource Limits Better Than a Tired On-Call”.

The prompt trick: give the model the intended job of the workload, then let it compare.

Prompt:

This ServiceAccount is used by a deployment that only reads ConfigMaps and

lists Pods in its own namespace. Below is the ClusterRole and RoleBinding.

List every permission that the workload does not need, grouped by

(1) wrong scope — cluster-wide where namespaced would do;

(2) wrong verb — write verbs on read-only workloads;

(3) wildcard grants.

Then output a corrected Role (namespaced) with the minimal verb/resource set,

and a one-line kubectl auth can-i check to prove the old grant was excessive.

RBAC:

<paste yaml>

For a read-only workload the answer usually collapses a ClusterRole into a namespaced Role with get/list on two resources — and the kubectl auth can-i create secrets --as=system:serviceaccount:prod:api check returns yes against the old binding, which is the sentence you show in the PR.

The wildcard is the smell, not the proof Do not accept "this looks broad." Ask the model for the exact verb+resource pair that is unnecessary and the command that proves it. A claim without the `can-i` line is a guess.

Why the Helm release failed — not a log retelling

The weak use of an LLM is explain this log. It will paraphrase. The strong use is: give it the rendered manifest, the values diff between the two revisions, and the error, and ask it to point at the line that changed and caused it.

Prompt:

A Helm release failed on upgrade. Below: the error, the values diff between

revision N-1 and N, and the rendered Deployment for revision N.

Do not restate the log. Answer:

1. Which rendered field changed and how it violates the API server's rule;
2. Whether the fix is in values.yaml, in the chart template, or in cluster state;
3. The exact helm command to inspect the failed revision without rolling back yet.
Error + diff + manifest:

<paste>

Nine times out of ten the culprit is a value that renders into an immutable field (selector, volumeClaimTemplates) — the fix is helm rollback plus a chart change, not a log hunt. The model names the field; you decide.

A vs B: where the LLM review actually fits

Criterion Live cluster tooling (kubectl, plan, scanners) LLM config review
Sees real state Yes No — reads what you paste
Explains why a diff matters Weak Strong
Catches excessive RBAC intent Only if you wrote a policy Yes, from the workload description
Runs before apply Yes Yes — on the plan text
Cost of a wrong answer Applies it You re-read before apply

Pick the LLM pass when the question is "is this change what I meant?". Pick the scanner when the question is "does this violate a rule?". Neither replaces the other, and the model never gets credentials.

One rule keeps this honest The model reviews text. It never holds a kubeconfig, never runs `apply`. Every prompt ends with a command *you* run to verify its claim.

If the failure is already in the cluster — CrashLoopBackOff, a chart that won't render — the review shifts from plan to diagnosis.

More on the topic: From CrashLoopBackOff to a Working Helm Chart: 12 Prompts That Turn an LLM Into Your Kubernetes Sidekick.

The value is not that the model knows your cluster. It is that it asks the question you skip on a Friday: which attribute moved, which permission is extra, which field is immutable. You still run the command. You just stop guessing why.

Rules and figures are stated as of November 2026.

← All posts

Ask AI about this article

Ask a question about this article — ASI Biont will answer based on its text.