You see CrashLoopBackOff in kubectl get pods. Your first instinct: kubectl delete pod or roll the deployment. That's not a fix — it's a reset button. The pod will crash again, and you'll have learned nothing. The real question is: why did it crash? And that's where an LLM can help — not by giving you a magic kubectl command, but by guiding you through a diagnostic sequence that surfaces the root cause.
This roundup is about prompts that turn an LLM into a diagnostic partner for Docker and Kubernetes. We'll look at five scenarios where LLMs genuinely speed up incident analysis, and where they can lead you astray if you don't verify. The core idea: use prompts that ask for evidence and next steps, not for fixes. LLMs are pattern-matching machines — they'll happily suggest kubectl delete pod if that's the most common answer in their training data. Your job is to steer them toward why before what.
Reading CrashLoopBackOff: from logs to hypothesis
CrashLoopBackOff means the container started, exited, and Kubernetes is waiting before restarting it. The logs are your primary evidence. But raw logs can be noisy. Here's a prompt that forces the LLM to extract a hypothesis: More on the topic: “From CrashLoopBackOff to a Working Helm Chart: 12 Prompts That Turn an LLM Into Your Kubernetes Sidekick”.
I have a pod in CrashLoopBackOff. Here are the last 50 lines of logs from `kubectl logs <pod> --previous`. [paste logs]. List the three most likely root causes based on the log patterns, and for each, give me one diagnostic command to confirm or refute it. Do not suggest restarting the pod until we have a confirmed cause.
Example output (abridged):
- Cause: missing environment variable DB_HOST → kubectl exec <pod> -- env | grep DB_HOST
- Cause: port already in use → kubectl describe pod <pod> | grep -A5 'Ports' and check hostPort conflicts
- Cause: file permission denied → kubectl exec <pod> -- ls -l /app/config
Notice the prompt explicitly forbids restart suggestions. That's crucial. The LLM will then focus on evidence. If you have a persistent volume claim issue, the logs might say "permission denied" — the LLM should ask you to check securityContext and volume ownership. This is where a human would look, but the LLM can enumerate the possibilities faster. More on the topic: “CI/CD Without Surprises: 12 Prompts That Make the LLM Write Pipelines, Fix Broken Builds and Explain Terraform Plans in Plain English”.
A common mistake: pasting logs without context. The LLM doesn't know your image, your entrypoint, or your environment. Add: "The container runs as user 1000, the image is based on alpine, and the entrypoint is /app/start.sh." That narrows the hypothesis space dramatically.
Dockerfile review: layers, cache, and vulnerabilities
Your Dockerfile builds fine, but the image is 1.2 GB and takes 8 minutes to build. An LLM can spot obvious inefficiencies if you ask the right questions: More on the topic: “From Dockerfile to Debugging Pods: 12 Prompts That Turn an LLM Into Your DevOps Partner”.
Here is my Dockerfile: [paste]. Identify: (1) layers that are not cache-friendly and why, (2) any commands that run as root unnecessarily, (3) packages that are installed but likely unused in a production image. For each, suggest a concrete change and the expected impact on build time or image size. Do not rewrite the whole file — just list the changes.
Example: The LLM might point out that COPY.. before RUN npm install busts the cache on every code change. The fix: copy package.json and package-lock.json first, run npm ci, then copy the rest. That alone can cut build time from 8 minutes to 90 seconds on incremental builds.
For vulnerabilities, a prompt like "Scan this Dockerfile for common security anti-patterns: running as root, using latest tags, exposing secrets in ENV or ARG, and missing USER directive" gives you a checklist. But remember: the LLM doesn't actually scan the image — it only reads the Dockerfile. For real vulnerability scanning, use trivy or grype. The LLM can help you interpret the output. More on the topic: “CI/CD as an Art: A Real Pipeline Breakdown and Costly Mistakes”.
OOMKilled and resource limits: the math behind the kill
OOMKilled means the container exceeded its memory limit. The naive fix is to raise the limit. The right fix is to understand why it exceeded. Here's a prompt that forces the LLM to do the math:
My pod was OOMKilled. The container has a memory limit of 512Mi. The application is a Java Spring Boot service with -Xmx400m. The heap dump shows 380MB of live objects. Calculate the total memory overhead (heap + metaspace + thread stacks + JVM overhead) and tell me if the limit is too low. If so, what limit would you recommend and why? Show your calculation.
The LLM should explain that the JVM needs memory beyond the heap: metaspace (often 50–100MB), thread stacks (1MB per thread by default), and direct buffers. A 400MB heap in a 512MB container is a recipe for OOMKilled because the JVM itself needs ~100–150MB overhead. The recommended limit might be 768Mi or 1Gi. But — and this is critical — the LLM's calculation is based on general knowledge, not your specific JVM flags. You must verify with kubectl top pod and the actual heap usage. Use the LLM to form a hypothesis, then test it.
Generating manifests and Helm charts — with a review step
LLMs are good at boilerplate. Ask for a Deployment manifest and you'll get one in seconds. But if you deploy it blindly, you might get: no resource requests, no liveness probe, imagePullPolicy: Always on a pinned tag (wasteful), or a Service with the wrong selector. The prompt must include a review loop:
Generate a Kubernetes Deployment and Service for a Node.js app. Image: myregistry/app:v1.2.3. Port: 3000. Replicas: 3. Include resource requests and limits, a liveness probe on /health, and a readiness probe on /ready. After generating, review your own output for common mistakes: missing labels, selector mismatch, missing securityContext. List any issues you find and fix them.
The self-review step is surprisingly effective — the LLM will often catch its own omissions. But you still need to run kubectl apply --dry-run=server to validate against your cluster's API version. And never let an LLM generate secrets or RBAC rules without manual review. A prompt like "Generate a Secret manifest with a database password" is dangerous — the LLM might hardcode a weak password or suggest storing it in plain text. Always use kubectl create secret or a sealed-secrets controller.
GitHub Actions with cache and secrets: CI/CD that doesn't leak
A typical CI pipeline for Docker builds: checkout, build, push. An LLM can add caching and secret handling, but you must specify the constraints:
Write a GitHub Actions workflow that builds a Docker image and pushes to GitHub Container Registry. Use the cache-from and cache-to options with GitHub Actions cache. The registry credentials are in secrets.GITHUB_TOKEN. Do not echo any secrets. Add a step that runs a vulnerability scan with Trivy and fails if critical vulnerabilities are found.
The LLM will produce a workflow with docker/build-push-action and cache-from: type=gha. But check: does it use secrets.GITHUB_TOKEN correctly? Does it expose the token in logs? A common LLM mistake is to write echo ${{ secrets.GITHUB_TOKEN }} for debugging — that's a leak. The prompt says "do not echo any secrets," which helps, but you should still scan the output. For more on CI/CD pipeline choices, see CodePipeline vs GitHub Actions: A CI/CD Pipeline Choice for AWS — and How to Master It with. More on the topic: “LeakCanary Says Where, LLM Says Why: Prompting Your Way Out of OutOfMemoryError in Android”.
Where LLMs accelerate and where they endanger
LLMs excel at: parsing logs, suggesting diagnostic commands, generating boilerplate, and explaining error messages. They falter at: knowing your specific cluster state, calculating exact resource needs without your metrics, and handling secrets securely. The rule: use LLMs to generate questions and hypotheses, not final answers. Always verify with kubectl describe, kubectl logs, and monitoring data. If you're preparing for a certification or want a structured approach to debugging, the article CKA + CKAD — Kubernetes Administrator & Developer: How to Fix CrashLoopBackOff and a Pod That Won't Start walks through the same diagnostic mindset. And for a broader view of what breaks in production, see Docker and Kubernetes: What Really Breaks in Production and How to Go from docker run to a Managed Cluster.
The next time a pod crashes, don't reach for kubectl delete. Reach for a prompt that asks "why?" — and then verify the answer yourself.