Your Pod Is CrashLooping and Your Pipeline Is Red: LLM Prompts That Cut the Guesswork

You deploy. The pod goes into CrashLoopBackOff. Or the pipeline is green locally and red in CI. You open the logs, scroll, grep, guess. An hour later you are still not sure whether the problem is the image, the config, the resource limits, or the secret that nobody mounted.

An LLM can shorten that loop — but only if you give it the right input and ask the right question. Below are prompts that work on real kubectl output, real Dockerfiles, real GitHub Actions YAML. Each one is copy-paste ready, with a note on when to use it and what you get back.

Step 1: Turn kubectl describe into a diagnosis, not a wall of text

kubectl describe pod prints everything: events, conditions, container states, mounts, limits. The useful part is usually three lines. The prompt below forces the model to find those three lines and ignore the rest.

When to use: the pod is not starting and you have the describe output but no clear error message.

Prompt:

You are a Kubernetes debugging assistant. Below is the output of `kubectl describe pod <name> -n <namespace>`. Identify the single most likely root cause of the pod not starting. Quote the exact lines from Events and Container State that support your conclusion. Then list, in order, the next three commands I should run to confirm or rule out your hypothesis. Do not suggest restarting the pod. Do not summarize the whole output.
From symptom to root cause in four steps
1
Symptom
CrashLoopBackOff, ImagePullBackOff, red pipeline
2
Collect evidence
kubectl describe, events, logs, CI log
3
Ask the LLM
Prompt with real output, ask for root cause
4
Confirm
Run the suggested command, fix, verify

[paste describe output here]

Example: a pod stuck in ImagePullBackOff. The events show Failed to pull image "myapp:latest": rpc error: code = NotFound. The model should point at the image tag and the registry, not at the node's disk pressure. If it suggests kubectl rollout restart, that is a sign the prompt needs the line "do not suggest restarting".

Step 2: Read the events like a timeline, not a list

Events are timestamped. The order matters: a failed mount at 10:01 and a readiness probe failure at 10:02 are related. Most people read the last event and stop.

When to use: the pod starts, then dies, then restarts — CrashLoopBackOff with no obvious exception in the logs. More on the topic: “From CrashLoopBackOff to a Working Helm Chart: 12 Prompts That Turn an LLM Into Your Kubernetes Sidekick”.

Prompt:

Here are the events from `kubectl get events --sort-by=.lastTimestamp -n <namespace>`. Build a timeline of what happened to pod <name>, in chronological order. For each event, state what it means in plain English. Then answer: at which point did the container first fail, and what was the immediate trigger? Ignore events about other pods unless they share a volume or a node with <name>.

[paste events here]

What you get: a sequence like "scheduled → pulled image → started container → liveness probe failed → container killed → restarted". The trigger is usually the probe, not the application code. That changes where you look.

Step 3: Build a Dockerfile that does not surprise you in production

A Dockerfile that works on your laptop can fail in the cluster for reasons that have nothing to do with your code: missing CA certificates, wrong user, no shell, architecture mismatch. A multi-stage build with a distroless or slim final image avoids most of that — but only if the model knows your runtime.

When to use: you are writing a new Dockerfile or replacing a single-stage one that produces a 1.2 GB image.

Prompt:

Write a multi-stage Dockerfile for a <language> application. Requirements:
- Build stage uses <builder image> and installs dependencies with caching.
- Final stage uses <runtime image> and contains only the built artifact and runtime dependencies.
- Run as a non-root user.
- Set a HEALTHCHECK that does not depend on curl or wget being installed.
- Pin base image versions by digest or exact tag, not `latest`.
Explain each stage in one sentence. Then list three things that could still break when this image runs in Kubernetes, and how to check each one.

My app listens on port <port> and needs <env vars>.

Example: for a Go service, the final image can be gcr.io/distroless/static-debian12:nonroot. The model should warn that HEALTHCHECK is ignored by Kubernetes (it uses probes) and that the binary must be statically linked. If it does not mention those, add them to the prompt.

Pin the digest, not the tag `latest` is not a version. A tag can be moved; a digest cannot. If your Dockerfile says `FROM node:20`, a rebuild next month may pull a different image. Pin by digest when the image must be reproducible.

Step 4: Explain a Helm error without reading the whole chart

Helm errors are cryptic: Error: UPGRADE FAILED: template: mychart/templates/deployment.yaml:45:23: executing "mychart/templates/deployment.yaml" at <$.Values.image.tag>: nil pointer evaluating interface {}.tag. The fix is usually one missing value, but finding which one takes time.

When to use: helm install or helm upgrade fails and the error points into a template you did not write.

Prompt:

I ran `helm upgrade` and got this error: <paste error>. Here is the relevant part of values.yaml: <paste values>. Here is the template line it points to: <paste template snippet>. Explain in plain English what Helm expected and what it got. Then give me the exact values.yaml change that fixes it. If the fix could break something else in the chart, say what.

Example: the error above means image.tag is not set in values.yaml and the template does not have a default. The fix is to add image.tag: "1.2.3" under image:. The model should also mention that --set image.tag=1.2.3 works for a one-off but is not a fix.

Step 5: Write GitHub Actions with cache and matrix — and know why it is red in CI

The most common CI failure is not a broken test. It is a difference between your machine and the runner: a different Node version, a missing environment variable, a cache that hides a stale dependency.

When to use: you are writing a new workflow, or a workflow that passes locally fails on GitHub Actions.

Prompt:

Write a GitHub Actions workflow for a <language> project. Requirements:
- Trigger on push to main and on pull_request.
- Use a matrix for <versions>.
- Cache dependencies with actions/cache, keyed on the lockfile hash.
- Run tests and lint in separate jobs.
- Do not print secrets; use `${{ secrets.<NAME> }}` only where needed.
Then list five reasons this workflow could pass on a developer laptop but fail on the runner, and how to detect each one from the logs.

What you get: a workflow plus a checklist. The usual suspects: Node version drift, missing CI=true behavior, case-sensitive file paths (macOS vs Linux), line endings, and a cache that restores node_modules from a different lockfile.

Step 6: Find the difference between local and CI — systematically

When the pipeline is red and local is green, the instinct is to re-run the job. That rarely helps. The prompt below makes the model compare environments field by field.

When to use: tests pass locally, fail in CI, and the error message is not obviously environmental.

Prompt:

My tests pass locally and fail in GitHub Actions. Here is the failing job log: <paste log>. Here is my local environment: OS <>, runtime version <>, package manager <>. The workflow uses <runner image> and <runtime version>. List every difference between the two environments that could affect the test result, ordered by likelihood. For each difference, give me the command to check it in CI and the fix.

Do not suggest re-running the job.

Example: a test that reads a file with a hardcoded path /Users/me/project/data.json will fail on the runner. The model should catch that from the log's stack trace. Another common one: TZ is UTC on the runner and local on your machine, so a date test flips.

The environment is part of the test If a test depends on the machine, it is not a unit test. The prompt above helps you find the dependency; the fix is to make the test independent of the environment.

Step 7: Read resource limits before they read you

A pod that gets OOMKilled has a limit that is too low or a memory leak. The describe output shows Last State: Terminated, Reason: OOMKilled. The prompt below helps you decide whether to raise the limit or fix the leak.

When to use: the pod restarts with OOMKilled, or the node is under memory pressure.

Prompt:

This pod was OOMKilled. Here are its resource requests and limits: <paste>. Here is the application's memory usage over the last hour from `kubectl top pod`: <paste>. The application is <language> and does <brief description>. Tell me: is the limit too low for normal operation, or is there likely a leak? What metrics would distinguish the two? Give me a concrete next step for each case.

What you get: a decision tree. If memory grows linearly and never drops, it is a leak — raising the limit only delays the crash. If memory spikes at startup and then stays flat, the limit is too low.

What to do with all this

The prompts above are not magic. They work because they force the model to quote evidence, ignore noise, and give you the next command instead of a lecture. The pattern is the same everywhere: paste the real output, ask for the root cause, ask for the next check.

Start with the one that matches your current fire. Then keep the prompt that worked — the next time the pod crashes, you will not be reading logs for an hour.

← All posts

Ask AI about this article

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