Before the Cluster Falls: LLM Prompts That Read Pods, Helm Charts, and Resource Limits Better Than a Tired On-Call

A pod has restarted 47 times overnight. The dashboard is red, the pager went off, and the first instinct is to kubectl delete pod. It comes back. It always comes back — because nobody read the exit code, the describe events, or the previous container's logs before reaching for the restart button. That is exactly the class of task where an LLM earns its keep: not to fix anything, but to read the pile of text you are too tired to read at 3 a.m. and point at the line that matters.

This roundup is about that specific job — using prompts for Kubernetes to diagnose a falling cluster from evidence, not guesses. Each prompt below comes with a real input, an expected output, and an honest note on where the model is guessing and where you must verify with kubectl.

Why the model beats you at reading CrashLoopBackOff at 3 a.m.

A kubectl describe pod on a crashing pod is a wall of noise: conditions, volumes, tolerations, and buried at the bottom, a handful of Events lines. The human brain skips to the end and reads the last event. The model reads all of it. That asymmetry is the whole value. More on the topic: “Prompts That Read a P&L Like a CFO: Unit Economics, Scenarios and Anomaly Hunting vs. Building the Model by Hand”.

But it only works if you feed it the right slice. Here is the prompt shape that consistently produces a real diagnosis instead of a shrug: More on the topic: “From CrashLoopBackOff to a Working Helm Chart: 12 Prompts That Turn an LLM Into Your Kubernetes Sidekick”.

You are a Kubernetes SRE. Below are three artifacts from a single pod: the `kubectl describe pod` output, the last 200 lines of `kubectl logs --previous`, and the container exit code.

Do not restart anything. Instead:
1. Classify the failure: config error, image problem, resource limit, missing dependency, or application crash.
2. Quote the exact line from describe or logs that supports your classification.
3. Name the single next kubectl command that would confirm or falsify your hypothesis.
4. If the evidence is insufficient, say so and list what is missing.

Describe output:
<paste>

Previous logs:
<paste>

Exit code: <code>

The last instruction matters more than it looks. Without it, the model invents a confident story. With it, you get an honest "I need the events section, not the conditions" — which is itself useful.

The exit code is the receipt: 137, 1, and 143 mean different things

Most engineers treat every crash the same. They are not. A container exit code is a fingerprint of who killed the process: More on the topic: “React Prompts That Kill useEffect Hell: A Working Cheat Sheet for Components, Hooks, and Tests”.

Exit code Meaning Typical cause
1 Application error Uncaught exception, failed config parse
137 SIGKILL (128+9) OOMKilled by the kernel, or kubectl delete
143 SIGTERM (128+15) Graceful shutdown, often a failed liveness probe
127 Command not found Wrong command: in the manifest

A prompt that forces the model to reason from the code first, before the logs, cuts the diagnostic loop roughly in half:

A pod exits with code 137. Its memory limit is 512Mi. Its `describe` shows `Last State: Terminated, Reason: OOMKilled`.

Explain: was this the application leaking memory, or was the limit simply too low for normal load? What data from `kubectl top pod` and the application's own heap metrics would separate the two? Give me a checklist, not a verdict.

Notice the prompt does not ask "should I raise the limit?" That question invites the wrong answer — raising the limit hides a leak. Ask what distinguishes the two causes instead.

Helm charts fail quietly long before the cluster does

Helm is where small mistakes compound. A missing resources block, a latest tag, a Service pointing at the wrong selector port — none of these fail at helm install. They fail three weeks later under load. An LLM is genuinely good at the static audit, because a chart is just text with rules..

Review this Helm chart's values.yaml and templates for production readiness. Flag, with the exact file and line:
- any container without CPU and memory requests/limits
- image tags that are `latest` or unpinned
- hardcoded secrets instead of references to a Secret
- a Service selector that does not match the Deployment's pod labels
- missing liveness/readiness probes

For each finding, state the consequence in one sentence. Do not rewrite the chart.

The last line is a guardrail. Ask it to rewrite and it will hand you a plausible chart that quietly changes your ingress paths. Ask it to flag and you stay in control. More on the topic: “Your Excel Chart Is Not an Analysis: LLM Prompts That Hunt Anomalies Before You Draw Anything”.

NetworkPolicy and ResourceQuota: the YAML you should never hand-write from memory

These two objects are pure syntax with no feedback loop until something breaks. A NetworkPolicy with the wrong podSelector silently blocks traffic; a ResourceQuota with a typo in a resource name is rejected or, worse, accepted and ignored. This is the safest place to let the model draft. More on the topic: “GPU Break-Even Math for Self-Hosted LLM vs API in a RAG Pipeline”.

Write a NetworkPolicy for namespace `payments` that:
- denies all ingress by default
- allows ingress on port 8080 only from pods labeled `app=api-gateway` in namespace `edge`
- allows egress to DNS on port 53 only

Output valid `networking.k8s.io/v1` YAML. Then list every assumption you made about labels and namespaces.

The assumptions list is the real deliverable — it tells you what to check against your actual cluster. Generate the YAML, then always run kubectl apply --dry-run=server before it touches anything live. A dry-run against the real API server catches schema errors the model cannot see. More on the topic: “CI/CD as an Art: A Real Pipeline Breakdown and Costly Mistakes”.

Where the model is confidently wrong

Three places, consistently:

  • The current API version. Models trained on older data still emit extensions/v1beta1 for Ingress or policy/v1beta1 for PodDisruptionBudget. Both are removed. Always check kubectl api-resources for what your cluster actually serves.
  • Your custom resources. The model does not know your CRDs. It will invent fields for your operator.
  • Cost and capacity math. Ask it to size a node pool and it will produce a number with no grounding in your workload. Do that arithmetic yourself from kubectl top.
The dry-run rule Every manifest an LLM generates gets `kubectl apply --dry-run=server` before it gets anything else. It is the cheapest lie detector you have.

What to hand over, and what to keep in your hands

A practical split that holds up in real on-call rotations:

  • Safe to delegate: reading logs and events, classifying failures, static chart audits, drafting NetworkPolicy and ResourceQuota, explaining an unfamiliar error message.
  • Delegate with mandatory review: generated manifests, suggested fixes, anything touching resource limits.
  • Keep for yourself: the decision to change production, capacity planning, and anything involving secrets — never paste a live Secret into a prompt.

The pattern is consistent: the model is a superb reader and a mediocre decision-maker. Point it at text, ask it to classify and quote evidence, and verify every conclusion with a command. That turns a 40-minute 3 a.m. scramble into a five-minute read — and keeps the cluster off the floor..

← All posts

Ask AI about this article

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