AI Context Engineering for DevOps Why Prompts Alone Aren't Enough

Troubleshoot slow Kubernetes DNS beyond CoreDNS. Learn how ndots, NodeLocal DNSCache, conntrack, and upstream DNS impact performance.

AI Context Engineering for DevOps Why Prompts Alone Aren't Enough

Everybody talks about prompts.

"Write me a Kubernetes Deployment."
"Generate Terraform for an AWS VPC."
"Explain why this pod is crashing."

For the past couple of years, prompt engineering has dominated nearly every conversation about AI. Entire courses have been built around writing better prompts, and countless articles promise that a few carefully chosen words will dramatically improve an AI's answers.

That advice worked well when large language models had almost no information beyond the text you typed into the chat window.

Modern AI assistants work differently.

Whether you're using Claude Code, GitHub Copilot, Cursor, Gemini CLI, or another AI-powered development tool, the biggest limitation usually isn't the prompt. It's the lack of context.

Imagine asking a senior SRE why an application is failing, then refusing to show them the logs, Kubernetes manifests, Grafana dashboards, Git history, or cluster topology. Even the best engineer would be forced to guess.

AI is no different.

The quality of its answers depends far more on the information it receives than on how cleverly the question is phrased.

That's why DevOps is rapidly moving beyond prompt engineering and toward something much more valuable: Context Engineering.

Instead of spending ten minutes rewriting the perfect prompt, experienced engineers spend those ten minutes giving AI the same information they would hand to another teammate during a production incident.

The difference in results is often dramatic.

Prompt Engineering vs Context Engineering

Prompt engineering focuses on asking better questions.

Context engineering focuses on providing better information.

That distinction sounds subtle, but it completely changes how AI should be used in production environments.

A well-written prompt can tell an AI what you want.

Context tells it what it's actually working with.

Consider a simple troubleshooting request.

"Why is my Kubernetes pod restarting?"

Without additional information, the AI has no option except to list common possibilities. It may mention memory limits, failed health probes, missing environment variables, image pull failures, or application crashes. All of those are technically valid, but they're also little more than educated guesses.

Now imagine asking the same question while also providing:

  • The Deployment manifest
  • The output of kubectl describe
  • Recent pod events
  • Container logs
  • Resource limits
  • The latest Git commit
  • CPU and memory graphs from Grafana

The question hasn't changed.

The AI has.

Instead of producing generic troubleshooting advice, it can begin reasoning about your actual environment. It can identify configuration mistakes, correlate recent deployments with failures, explain why a probe is failing, or even spot inconsistencies that would be difficult to notice manually.

The prompt stayed almost identical.

The context completely changed the quality of the answer.

What Exactly Is Context Engineering?

Context engineering is the practice of giving AI everything it needs to understand your environment before asking it to make decisions.

That context can come from many different places.

It might include Kubernetes manifests that describe your workloads, application logs showing recent failures, Prometheus metrics revealing performance issues, Git history explaining what changed, or infrastructure diagrams that describe how systems communicate with each other.

Instead of expecting AI to infer missing information, context engineering removes the need for guesswork altogether.

The workflow looks something like this:

Engineer
Prompt
Kubernetes Manifests Application Logs
Grafana Metrics Git History
Cluster Topology Runbooks & Documentation
AI Assistant
Context-Aware Recommendations

The important point is that none of these sources are new. DevOps teams already collect them every day. Context engineering simply combines them so AI can reason with the same operational knowledge available to human engineers.

Why Better Prompts Still Produce Bad Answers

One of the biggest misconceptions surrounding AI is that poor answers are always the result of poor prompts.

In reality, they're often the result of missing information.

Suppose a pod enters CrashLoopBackOff.

You ask an AI assistant why it's happening.

Without any supporting data, it might suggest checking resource limits, image tags, startup probes, application logs, or recent deployments. None of these suggestions are wrong, but they're also not particularly useful because they apply to almost every Kubernetes failure.

Now provide the container logs, the Deployment YAML, the pod events, and the latest rollout history.

Suddenly the AI notices that the application cannot connect to PostgreSQL because an environment variable was renamed in yesterday's deployment.

The model didn't suddenly become more intelligent.

It simply had enough information to stop guessing.

This is one of the biggest lessons platform engineers are discovering as AI becomes part of daily operations. The smartest models in the world still make poor decisions when they're forced to work with incomplete information.

Context doesn't just improve AI responses.

It reduces hallucinations, speeds up troubleshooting, and produces recommendations that are grounded in the actual state of your infrastructure rather than statistical probability.

The Seven Sources of Context Every AI Needs

Once you understand that AI is only as effective as the information it receives, the next question becomes obvious:

What information actually matters?

The answer isn't "everything." Dumping hundreds of log files or an entire Git repository into an AI model rarely improves the outcome. Good context engineering is about providing the right information at the right time.

For most DevOps and platform engineering tasks, seven sources of context consistently produce the biggest improvements.

1. Kubernetes Manifests Tell AI What Should Exist

If you're asking AI to troubleshoot Kubernetes without sharing your manifests, you're asking it to solve a puzzle with half the pieces missing.

Your manifests describe the intended state of the cluster. They reveal how applications are deployed, which images they're running, what resources they're allowed to consume, how traffic reaches them, and what configuration they depend on.

A typical troubleshooting session might involve resources such as:

  • Deployment
  • Service
  • ConfigMap
  • Secret
  • Ingress
  • PersistentVolumeClaim
  • HorizontalPodAutoscaler
  • NetworkPolicy

Without seeing those resources, AI has no reliable way to understand how your application is supposed to behave.

Imagine asking why an application isn't receiving traffic. The answer could be a missing Service selector, an incorrect Ingress rule, a failed readiness probe, or a NetworkPolicy blocking communication. All of those possibilities become much easier to identify once the manifests are available.

Static configuration is often where production problems begin.

Giving AI access to those manifests allows it to reason from facts instead of assumptions.

2. Logs Explain What Actually Happened

Configuration tells you what should happen.

Logs tell you what actually happened.

This is one of the biggest mistakes engineers make when working with AI. They'll ask why an application crashed but never provide the logs generated immediately before the failure.

For Kubernetes workloads, useful logs often come from multiple sources rather than a single application.

These commonly include:

  • Application logs
  • Container logs
  • Kubelet logs
  • CoreDNS logs
  • Ingress controller logs
  • Operator logs
  • Controller Manager logs

Each source reveals a different part of the story.

An application log might show a failed database connection.

The kubelet may reveal repeated probe failures.

The Ingress controller could expose routing errors.

CoreDNS logs might explain why service discovery suddenly stopped working.

Individually, each log provides only part of the picture.

Together, they allow AI to connect events that would otherwise appear unrelated.

That's why experienced SREs rarely troubleshoot using only one log source, and neither should AI.

3. Metrics Replace Guesswork With Evidence

Logs explain what happened.

Metrics explain how the system behaved while it happened.

Suppose an application begins responding slowly.

Without metrics, AI may suggest increasing CPU limits, adding more replicas, investigating storage latency, or checking the network.

Those are reasonable suggestions, but they're still guesses.

Now imagine providing recent Prometheus metrics alongside your question.

The CPU graph remains flat.

Memory usage is stable.

Network latency suddenly spikes.

Request duration increases at exactly the same time.

The conversation immediately changes.

Instead of listing generic troubleshooting advice, AI can begin correlating events and narrowing the investigation.

Some of the most useful metrics include:

  • CPU utilisation
  • Memory consumption
  • Network throughput
  • Disk latency
  • Request latency
  • Error rates
  • Pod restart count
  • DNS latency

Modern observability platforms already collect this information continuously.

Context engineering simply makes that data available during the conversation instead of leaving AI to speculate.

4. Git History Often Explains the Incident Before the Logs Do

One of the most underrated sources of context is Git.

Production incidents rarely appear out of nowhere.

Something usually changed.

A deployment was updated.

A ConfigMap was modified.

A Helm chart was upgraded.

A security policy was tightened.

Git already records every one of those changes.

Yet many engineers never think to include recent commits when asking AI for help.

Sometimes the fastest way to explain an outage isn't by reading logs.

It's by asking a much simpler question:

"What changed?"

Even a few commands can provide remarkably valuable context.

git log --oneline

git diff HEAD~1

git blame deployment.yaml

If a service began failing immediately after a deployment, the answer may already exist in the latest commit history.

Rather than treating Git as version control alone, context engineering treats it as operational history.

That historical context often allows AI to connect production failures directly to the changes that introduced them.

5. Infrastructure Topology Gives AI the Bigger Picture

An application rarely exists in isolation.

A single request may pass through a load balancer, an API gateway, multiple Kubernetes Services, a service mesh, several microservices, databases, caches, and external APIs before returning a response.

Without understanding that architecture, AI only sees individual components.

It doesn't understand how they interact.

A simple topology diagram immediately changes that.

For example:

Client
Load Balancer
Ingress Controller
Kubernetes Services
Application Pods
Database

Once AI understands where each component sits in the request path, it becomes much better at identifying likely failure points.

A timeout at the client doesn't necessarily mean the application is slow.

The problem may exist several hops earlier.

Topology provides the missing perspective that individual logs and metrics often cannot.

6. Runbooks and Documentation Capture What Your Team Already Knows

Every engineering team accumulates knowledge over time.

Someone spends hours debugging a production incident, identifies the root cause, documents the fix, and then moves on. A few months later, the exact same issue happens again, but the person who solved it is on leave. Another engineer starts investigating from scratch, unaware that the solution already exists somewhere in Confluence, Notion, GitHub, or an internal wiki.

AI faces the same problem.

If it can't access your team's documentation, it's forced to solve problems from first principles every time. That often leads to generic recommendations instead of practical solutions that have already been validated in your own environment.

Good sources of operational knowledge include:

  • Runbooks
  • Incident postmortems
  • Internal wikis
  • Architecture documentation
  • Standard operating procedures
  • Deployment guides

For example, your company may already have a documented procedure explaining that every PostgreSQL failover requires restarting a specific application or that a particular service should never be deployed before another dependency becomes healthy.

A general-purpose AI model has no way of knowing that.

When you provide those documents as context, AI stops behaving like a search engine and starts behaving more like a teammate who understands how your organization operates.

Context engineering isn't only about technical data. It's also about institutional knowledge.

7. Live Cluster State Matters More Than Static Configuration

One of the biggest mistakes engineers make is assuming that YAML tells the whole story.

It doesn't.

A Deployment manifest describes the desired state of an application. It doesn't tell you whether the rollout completed successfully, whether pods are currently pending, whether nodes are under pressure, or whether Kubernetes has generated warning events in the last few minutes.

Production clusters change constantly.

Pods restart.

Nodes join and leave.

Autoscalers create new replicas.

Controllers reconcile resources.

Events appear and disappear.

Static manifests quickly become outdated.

That's why live cluster information is one of the most valuable sources of context you can provide.

Useful commands include:

kubectl get pods -A

kubectl describe pod <pod-name>

kubectl get events --sort-by=.lastTimestamp

kubectl get nodes

kubectl top pods

kubectl top nodes

These commands reveal information that simply doesn't exist inside Git repositories.

For example, a Deployment may look perfectly valid, but kubectl describe immediately reveals repeated readiness probe failures. The YAML hasn't changed, but the live state tells a completely different story.

The more closely AI can observe your cluster's current state, the less it has to rely on assumptions.

Context Engineering in Practice

The easiest way to understand context engineering is to compare two troubleshooting conversations.

Imagine an application suddenly starts restarting.

The first engineer asks AI:

"My Kubernetes pod keeps restarting. What's wrong?"

The AI responds with a long list of possibilities.

It could be memory pressure.

A failing liveness probe.

An application bug.

A missing Secret.

A bad image.

A startup failure.

None of these suggestions are particularly helpful because they're based on probability rather than evidence.

Now consider a different approach.

The engineer provides:

  • The Deployment manifest
  • Pod events
  • kubectl describe output
  • Container logs
  • Recent Prometheus graphs
  • The latest Git commit
  • Resource requests and limits
  • Network policies affecting the workload

The question is almost identical.

The context isn't.

Instead of producing generic troubleshooting advice, the AI can follow the same reasoning process an experienced platform engineer would. It can identify a failed rollout, correlate it with yesterday's configuration change, explain why the readiness probe is failing, and even suggest the most likely fix based on the evidence.

That's the real value of context engineering.

You're not making AI smarter.

You're giving it enough information to stop guessing.

Why Model Context Protocol (MCP) Changes Everything

Until recently, context engineering mostly meant copying and pasting information into a chat window.

Logs were copied manually.

YAML was pasted manually.

Metrics were described manually.

Documentation was summarized manually.

That approach doesn't scale.

This is exactly the problem the Model Context Protocol (MCP) is designed to solve.

Instead of requiring engineers to collect information themselves, MCP allows AI assistants to retrieve context directly from the systems they already use.

Depending on the tools available, an AI assistant could automatically access:

  • Kubernetes clusters
  • Git repositories
  • Grafana dashboards
  • Prometheus metrics
  • Datadog
  • Jira
  • Slack
  • Confluence
  • Internal documentation

Rather than asking you to paste five different files into a conversation, the AI can retrieve the relevant information itself before attempting to answer.

This changes AI from a chatbot into something much closer to an operational assistant.

The quality of the answer no longer depends on how much information you remembered to include. It depends on how effectively the AI can access the systems that already contain that information.

This is why many engineers believe context engineering will become far more important than prompt engineering over the next few years.

Prompts tell AI what you want.

Context tells it what it needs to know.

AI Still Can't Read Your Mind

One misconception that has followed AI since the beginning is the idea that larger models automatically produce better answers.

In reality, even the most capable model has one major limitation.

It only knows what you tell it.

An AI assistant may understand Kubernetes, Linux, Terraform, Helm, Prometheus, and cloud architecture because it has learned those concepts from publicly available information. What it doesn't know is everything that makes your environment unique.

It doesn't know that one namespace is reserved for production traffic. It doesn't know that your company deploys every Friday evening. It doesn't know that a service named payments-api-v2 was introduced yesterday or that your team intentionally disabled a readiness probe because of a known bug.

It doesn't know which Grafana dashboard your SRE team relies on during incidents or which runbook everyone follows when a production database starts failing.

None of that information exists inside the model until you provide it.

This is why two engineers can ask the same AI assistant exactly the same question and receive completely different results. The difference usually isn't the wording of the prompt. It's the operational context they shared beforehand.

The best AI conversations look remarkably similar to conversations between experienced engineers. Before suggesting a fix, they gather logs, inspect recent deployments, review dashboards, compare configuration changes, and understand the architecture.

Good engineers don't jump to conclusions.

Neither should AI.

Best Practices

Context engineering isn't about overwhelming AI with every piece of information you have. The goal is to provide enough relevant context for the model to understand the problem without burying it in unnecessary details.

A few practices consistently produce better results:

  • Share Kubernetes manifests when troubleshooting deployments, networking, or configuration issues.
  • Include application and infrastructure logs instead of describing errors from memory.
  • Provide metrics and dashboards whenever performance or reliability is involved.
  • Add recent Git commits or deployment history so AI can understand what changed.
  • Explain your infrastructure topology when multiple services or clusters are involved.
  • Include internal runbooks or documentation whenever they contain relevant operational knowledge.
  • Capture the live cluster state using commands like kubectl describe and kubectl get events instead of relying only on static YAML.
  • Treat AI like a new teammate. Give it the same information you would provide to another engineer joining a production incident.

None of these practices are particularly complicated, but together they dramatically improve the quality of AI-assisted troubleshooting. Better context reduces guesswork, speeds up root cause analysis, and produces recommendations based on evidence rather than assumptions.

Conclusion

Prompt engineering helped engineers discover what AI could do.

Context engineering is showing us what AI can actually become.

As DevOps teams increasingly rely on AI for debugging, automation, infrastructure reviews, and incident response, success will depend less on writing clever prompts and more on providing meaningful operational context. Kubernetes manifests, logs, metrics, Git history, dashboards, architecture diagrams, and runbooks already exist within most engineering organizations. The challenge isn't collecting more information. It's making the right information available at the moment decisions need to be made.

The teams that get the most value from AI won't necessarily be the ones using the newest models. They'll be the ones with the best operational context.

After all, the most valuable engineer during an outage isn't the one who asks the smartest question.

It's the one who already has the evidence.

"AI doesn't become more reliable because you write better prompts. It becomes more reliable because you give it the same context you'd give your best engineer."