This prompt is designed for platform engineers and SREs who are actively investigating an unexpected pod termination and have already exhausted the immediate surface-level details from kubectl describe pod. The job-to-be-done is to move from observing a terminated pod to understanding the causal chain of cluster-level decisions that led to the eviction. The ideal user has collected raw Kubernetes event streams, node condition statuses, and resource metrics, and now needs a structured differential diagnosis to decide whether the fix involves adjusting resource limits, modifying scheduling constraints, or escalating to a cluster administrator. The prompt instructs the LLM to act as a Kubernetes incident analyst, correlating pod status fields, event streams, node conditions, and cluster configurations to classify the eviction reason into categories like resource pressure, node condition changes, taint/toleration mismatches, priority preemption, or API-initiated evictions.
Prompt
Kubernetes Pod Eviction Root Cause Analysis Prompt

When to Use This Prompt
Defines the precise operational context, required inputs, and boundaries for using the Kubernetes Pod Eviction Root Cause Analysis Prompt in an on-call investigation workflow.
Before using this prompt, ensure you have gathered the complete output of kubectl get events for the namespace and timeframe of the incident, the full YAML output of the terminated pod (kubectl get pod <name> -o yaml), and the node description (kubectl describe node <node-name>) for the node where the pod was last scheduled. The prompt is most effective when the eviction reason is not immediately obvious—for example, when the pod status shows Evicted but the events are ambiguous, or when multiple pods are being terminated in a pattern that suggests a cluster-wide condition. It is not a replacement for real-time monitoring dashboards or alerting systems; it is a forensic analysis tool for post-incident investigation.
Do not use this prompt when the pod failure is clearly an application-level crash (e.g., a non-zero exit code from the container process) without any Kubernetes eviction signal. In those cases, a stack trace or log analysis prompt is more appropriate. Similarly, avoid this prompt if you have not yet collected the raw Kubernetes state—feeding incomplete or guessed data will produce a plausible but incorrect eviction chain. The output should be treated as a high-confidence hypothesis that still requires validation against your cluster's actual configuration and metrics before any remediation is applied. For high-severity production incidents, always pair the LLM's analysis with a human review of the proposed prevention strategy before making changes to resource limits, affinity rules, or priority classes.
Use Case Fit
Where this prompt works and where it does not. Understand the operational boundaries before wiring it into an incident response harness.
Good Fit: Structured Cluster Telemetry
Use when: You have structured Kubernetes events, node conditions, and resource metrics available. The prompt excels at correlating eviction reasons (e.g., NodePressure, TaintToleration) with pod specs and priority classes. Guardrail: Feed the prompt a sanitized kubectl describe pod and kubectl get events output for the target pod and node.
Bad Fit: Network or Storage Subsystem Failures
Avoid when: The root cause lies outside the Kubernetes control plane, such as CNI plugin crashes, CSI driver timeouts, or cloud-provider API rate limiting. The prompt will hallucinate resource-pressure explanations for non-resource failures. Guardrail: Pre-filter incidents with a network reachability and volume health check before invoking this prompt.
Required Inputs: Event Timeline and Node State
Risk: Without a time-sorted event stream and node condition snapshot, the prompt cannot distinguish cause from effect. Guardrail: Always include kubectl describe node output and pod events sorted by lastTimestamp. Missing timestamps lead to inverted eviction chains.
Operational Risk: Priority Preemption Blind Spots
Risk: The prompt may attribute eviction solely to resource pressure when preemption by a higher-priority workload is the true cause. Guardrail: Explicitly include the pod's priorityClassName and any PriorityClass definitions in the cluster context. Cross-reference with the scheduler logs if available.
Operational Risk: Stale or Partial Data
Risk: Running the prompt on a snapshot taken minutes after eviction can miss transient conditions like DiskPressure that have since cleared. Guardrail: Capture node conditions and pod events at the time of the alert, not at investigation time. Pair with a monitoring webhook that snapshots state on eviction.
Escalation Boundary: Human Review for Tuning Changes
Risk: The prompt's prevention strategy may recommend resource limit changes or node taint modifications that affect other workloads. Guardrail: Treat resource tuning recommendations as proposals, not automated actions. Require human approval before applying LimitRange or ResourceQuota changes in production.
Copy-Ready Prompt Template
A copy-ready prompt template for classifying Kubernetes pod eviction root causes and generating prevention strategies.
This template is designed to be pasted directly into your AI harness. It expects structured input data collected from your cluster before the investigation begins. Replace every square-bracket placeholder with real values gathered from kubectl describe pod, kubectl get events, node conditions, and the cluster's resource metrics. The prompt forces the model to correlate pod-level signals with node-level and cluster-level state before producing a conclusion.
textYou are an SRE assistant specializing in Kubernetes pod lifecycle analysis. Analyze the following pod eviction event and determine the root cause. ## POD CONTEXT - Pod Name: [POD_NAME] - Namespace: [NAMESPACE] - Node Name: [NODE_NAME] - Priority Class: [PRIORITY_CLASS] - QoS Class: [QOS_CLASS] - Container Resource Requests: [CONTAINER_REQUESTS] - Container Resource Limits: [CONTAINER_LIMITS] ## EVICTION EVENT - Eviction Reason (from pod status): [EVICTION_REASON] - Eviction Timestamp: [EVICTION_TIMESTAMP] - Termination Message: [TERMINATION_MESSAGE] ## NODE STATE AT EVICTION TIME - Node Conditions (Ready, MemoryPressure, DiskPressure, PIDPressure): [NODE_CONDITIONS] - Allocatable Resources: [NODE_ALLOCATABLE] - Capacity: [NODE_CAPACITY] - Recent Node Events (last 15 minutes): [NODE_EVENTS] ## CLUSTER-WIDE CONTEXT - Other Pods Evicted on Same Node (last 10 minutes): [CO_EVICTED_PODS] - Cluster Autoscaler Events (if any): [AUTOSCALER_EVENTS] - Recent Taints Applied to Node: [RECENT_TAINTS] ## OUTPUT REQUIREMENTS Produce a JSON object with the following schema: { "eviction_classification": "ResourcePressure | NodeCondition | TaintToleration | PriorityPreemption | Unknown", "primary_cause": "One-sentence root cause explanation grounded in the provided data.", "evidence_chain": [ "Step-by-step reasoning linking pod state, node state, and cluster events to the conclusion." ], "prevention_strategy": { "immediate_action": "What to do now to prevent recurrence on this node.", "long_term_fix": "Configuration, resource, or scheduling policy change needed.", "monitoring_improvement": "Alert or dashboard that would have caught this earlier." }, "confidence": "High | Medium | Low", "missing_data": ["List any data points that would increase confidence if available."] } ## CONSTRAINTS - Do not invent events, metrics, or node conditions not present in the input. - If the eviction reason is ambiguous, state the leading hypothesis and what would rule it out. - If priority preemption is suspected, explicitly name the preempting pod and its priority. - If the data is insufficient for a High-confidence classification, set confidence accordingly and list what's missing.
Adaptation notes: If your cluster runs a custom scheduler or uses descheduler policies, add a [SCHEDULER_POLICY] placeholder and include relevant descheduler logs. For air-gapped environments where the model cannot access live cluster APIs, this prompt must be fed entirely from pre-collected data. The output schema is designed to be machine-readable for downstream automation—if a human is the primary consumer, consider adding a narrative_summary field. Always validate the JSON output against the schema before acting on the immediate_action field, especially in production clusters where a bad recommendation could trigger unnecessary node drains.
Prompt Variables
Each placeholder must be populated before the prompt is sent. Incomplete variables degrade classification accuracy and may cause the model to hallucinate eviction reasons.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[POD_EVENTS_YAML] | Full kubectl describe pod output including Events section with timestamps | Events: Type Reason Age From Message Warning Evicted 5m kubelet The node was low on resource: memory | Must contain at least one Evicted or Failed event. Reject if Events section is empty or truncated. Parse for Type, Reason, Age, and Message fields. |
[NODE_CONDITIONS_JSON] | Node status conditions array from kubectl get node -o json showing MemoryPressure, DiskPressure, PIDPressure | [{"type":"MemoryPressure","status":"True","lastTransitionTime":"2025-01-15T14:22:00Z"}] | Must include MemoryPressure, DiskPressure, and PIDPressure condition types. Reject if conditions array is missing or node name does not match pod's assigned node. |
[NODE_ALLOCATABLE_YAML] | Node allocatable and capacity resource values for CPU, memory, and ephemeral storage | Allocatable: cpu: 3920m memory: 14Gi ephemeral-storage: 80Gi | Must contain allocatable memory in Mi or Gi units. Reject if memory field is null or zero. Cross-check that pod resource requests exceed allocatable for preemption classification. |
[POD_RESOURCE_SPEC_YAML] | Pod spec section showing resource requests and limits for all containers | containers:
| Must include requests and limits for at least one container. Reject if resources block is absent. Compare limits against node allocatable for OOM eviction path. |
[PRIORITY_CLASS_YAML] | PriorityClass definition for the evicted pod including value and preemptionPolicy | value: 1000 preemptionPolicy: PreemptLowerPriority | Required only when eviction reason is Preemption. Set to null if pod has no priorityClass. Validate value is integer and preemptionPolicy is Never or PreemptLowerPriority. |
[TAINT_TOLERATION_YAML] | Node taint list and pod toleration spec for taint-based eviction analysis | taints:
| Cross-reference node taints with pod tolerations. Reject if taint list is present but tolerations are missing. Flag mismatched effect values as potential eviction cause. |
[RECENT_DEPLOY_LOG] | Last 20 lines of deployment or statefulset rollout history showing recent changes | REVISION CHANGE-CAUSE 5 kubectl set resources deployment/app --limits=memory=4Gi 6 kubectl apply -f deployment.yaml | Optional field. Set to null if no recent deploy within eviction window. When provided, parse for resource limit changes or replica count modifications that correlate with eviction timing. |
[CLUSTER_EVENT_WINDOW_MINUTES] | Time window in minutes before eviction to search for correlated cluster events | 15 | Must be positive integer between 1 and 60. Default to 15 if not specified. Controls scope of node condition transitions and taint additions considered in eviction chain. |
Implementation Harness Notes
How to wire the eviction analysis prompt into a production incident response or automated investigation workflow.
This prompt is designed to be called programmatically during an active incident or as part of an automated post-eviction analysis pipeline. The primary integration point is a webhook receiver that triggers on Evicted or Failed pod events from the Kubernetes API, or from monitoring systems like Prometheus AlertManager when pod disruption metrics spike. The harness must gather the required inputs—pod manifest, events, node conditions, and resource metrics—before invoking the model, because the prompt's diagnostic accuracy depends entirely on the completeness and freshness of this context.
Build a thin orchestration layer that queries the Kubernetes API for the evicted pod's last known spec, the node it was scheduled on, all events in the pod's namespace filtered by the pod name, and the node's conditions and allocatable capacity at the time of eviction. If your cluster runs metrics-server or Prometheus, also pull the pod's recent CPU/memory usage and the node's pressure metrics. Assemble these into the [EVIDENCE] placeholder as structured JSON or YAML. Validation step: before calling the model, verify that the evidence payload contains at least the pod phase, eviction reason, node name, and a timestamp. If any required field is missing, abort the model call and surface a data-gathering failure to the operator instead of generating an unreliable analysis.
For model selection, prefer a model with strong structured reasoning and JSON output capabilities, such as Claude 3.5 Sonnet or GPT-4o, because the prompt requires multi-hypothesis comparison and evidence weighting. Set temperature=0 or very low to maximize reproducibility. The output schema defined in the prompt should be enforced via the model's JSON mode or structured output API, not via post-hoc regex parsing. Retry logic: if the model returns a malformed JSON response or fails to populate the eviction_chain array, retry once with a simplified instruction appended: 'Your previous response was invalid. Return only valid JSON matching the output schema.' If the second attempt fails, escalate to a human responder with the raw evidence and the failed model output attached.
Log every invocation with the evidence payload, model response, and a correlation ID tied to the incident or alert. This audit trail is critical for postmortem reviews and for tuning the prompt over time. Human review gate: for any eviction classified as PriorityPreemption or NodePressure with a confidence score below 0.7, route the analysis to an on-call engineer for confirmation before auto-remediating. Auto-remediation—such as adjusting resource limits, adding node selectors, or cordoning a node—should only trigger when the eviction classification confidence exceeds 0.85 and the recommended action is idempotent. Never auto-apply taint changes or priority class modifications without human approval.
Finally, treat this prompt as a diagnostic tool, not a replacement for cluster-level observability. It works best when paired with a runbook that already defines standard responses to common eviction types. Use the model's output to accelerate the investigation, but always cross-reference its findings against your cluster's actual state before taking action. The most common production failure mode is stale evidence: if the harness queries the API too late and the node or pod state has changed, the model will produce a plausible but incorrect root cause. Mitigate this by timestamping all evidence and discarding any data older than the eviction event by more than 60 seconds.
Expected Output Contract
Validate these fields before accepting the model output. Reject or retry if required fields are missing, malformed, or unsupported.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
eviction_chain | array of objects | Array length >= 1. Each object must have 'step', 'actor', 'reason', and 'timestamp' fields. | |
eviction_chain[].step | integer | Sequential integer starting at 1. Must increment by 1 per element. | |
eviction_chain[].actor | string enum | Must be one of: kubelet, scheduler, controller-manager, kernel, user, unknown. | |
eviction_chain[].reason | string | Non-empty string matching a known eviction reason pattern (e.g., NodePressure, Preempted, TaintViolation). | |
eviction_chain[].timestamp | ISO 8601 string | Parseable as valid ISO 8601 datetime. Must be in chronological order matching step sequence. | |
root_cause_classification | string enum | Must be one of: ResourcePressure, NodeCondition, TaintToleration, PriorityPreemption, OOMKill, DiskPressure, Unknown. | |
prevention_strategy | array of objects | Array length >= 1. Each object must have 'action', 'target_resource', and 'expected_effect' fields. | |
confidence_score | number | Float between 0.0 and 1.0 inclusive. If below 0.7, 'evidence_gaps' array must be non-empty. |
Common Failure Modes
What breaks first when using an LLM for Kubernetes pod eviction root cause analysis and how to guard against it.
Hallucinated Eviction Reasons
What to watch: The model invents a plausible-sounding eviction reason (e.g., 'disk pressure') when the actual cause is missing from the provided context or ambiguous in the events. Guardrail: Require the model to cite specific Kubernetes event messages, node condition timestamps, or metrics data points for every claim. If evidence is insufficient, the output must explicitly state 'insufficient data to determine root cause' rather than guessing.
Confusing Correlation with Causation
What to watch: The model observes that a node condition appeared around the same time as the eviction and incorrectly asserts it as the root cause, ignoring the actual trigger (e.g., a taint that preceded the condition). Guardrail: Structure the prompt to require a chronological ordering of events and explicit causal linking. Include a verification step that checks whether the proposed cause temporally precedes the effect and whether alternative explanations were ruled out.
Ignoring Priority Preemption Nuance
What to watch: The model attributes an eviction to resource pressure when the real cause is priority-based preemption by a higher-priority Pod, missing the preemption signal entirely. Guardrail: Add a dedicated analysis step for PriorityClass and preemption events. Require the output to check for the presence of a higher-priority Pod scheduled at the same time before concluding resource pressure was the cause.
Stale or Incomplete Context Blindness
What to watch: The model produces a confident analysis based on partial data (e.g., only pod events without node conditions, or metrics from a different time window), leading to a wrong diagnosis. Guardrail: Validate input completeness before analysis. The prompt should enumerate required data sources (pod events, node conditions, resource metrics, taints) and refuse to produce a final classification if critical inputs are missing, instead returning a data gap report.
Overfitting to Common Patterns
What to watch: The model defaults to the most common eviction reason (e.g., OOMKill) for your cluster without adequately analyzing the specific evidence, missing rare but critical causes like disk pressure on image pull or node shutdown. Guardrail: Include a checklist of all possible eviction categories in the prompt and require the model to explicitly rule out each one with evidence before selecting the final classification.
Prevention Strategy Mismatch
What to watch: The model correctly identifies the root cause but recommends a generic or incorrect prevention strategy (e.g., suggesting a resource limit increase for a preemption problem). Guardrail: Map each eviction classification to a constrained set of valid remediation categories in the output schema. Require the prevention strategy to directly reference the diagnosed cause and include before/after resource or configuration deltas where applicable.
Evaluation Rubric
Run these checks against a golden dataset of known eviction scenarios before shipping the prompt to production. Each criterion validates a specific quality dimension of the eviction chain explanation and prevention strategy output.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Eviction Reason Classification | Output correctly identifies the primary eviction reason from the set {ResourcePressure, NodeCondition, TaintToleration, PriorityPreemption, Unknown} and matches the golden label. | Misclassification of eviction type or assignment of Unknown when sufficient evidence exists in pod events and node state. | Run 20 labeled eviction scenarios through the prompt. Measure exact-match accuracy against golden labels. Require >= 90% accuracy. |
Eviction Chain Completeness | Output traces the full causal chain from triggering condition through scheduler decision to pod termination, with at least 3 linked events in sequence. | Missing intermediate events, skipping from trigger directly to termination without explaining scheduler or kubelet actions. | Parse output for event sequence length and causal linking language. Flag outputs with fewer than 3 distinct chain steps. Manually review 10 samples for logical completeness. |
Source Grounding | Every claim in the eviction chain cites a specific source: pod events, node conditions, resource metrics, or taint specifications from the provided [INPUT]. | Claims about memory pressure or node state without referencing provided metrics or event fields. Fabricated threshold values. | Use LLM-as-judge to check each sentence for source attribution. Flag unsupported claims. Require >= 95% of claims to have explicit source grounding. |
Prevention Strategy Specificity | Output includes at least 2 concrete, actionable prevention recommendations tied to the diagnosed eviction reason, with specific resource values or configuration changes. | Generic advice like 'increase resources' or 'check node health' without specific limits, requests, tolerations, or priority class changes. | Extract prevention recommendations. Validate each contains a specific Kubernetes resource field or configuration parameter. Require >= 2 specific recommendations per output. |
Priority Preemption Handling | When eviction reason is PriorityPreemption, output identifies the preempting pod's priority class, the victim pod's priority class, and the priority difference. | Omitting priority class names or failing to explain why the victim was selected over other lower-priority pods. | Filter golden dataset to preemption cases only. Check output for presence of both priority class names and a comparison statement. Require 100% on this subset. |
Node Condition Correlation | When eviction reason is NodeCondition, output maps the specific node condition (e.g., MemoryPressure, DiskPressure, PIDPressure) to the eviction event timestamp. | Listing all node conditions without identifying which one triggered the eviction or mismatching condition type to eviction reason. | For node-condition-labeled cases, parse output for condition-to-eviction mapping. Validate condition type matches golden label. Require exact match on condition type. |
Output Schema Compliance | Output strictly follows the [OUTPUT_SCHEMA] with all required fields present and no extra top-level keys. | Missing required fields like 'eviction_chain' or 'prevention_strategy'. Extra fields not defined in schema. Nested structure violations. | Validate output against JSON Schema definition. Reject any output that fails structural validation. Require 100% schema compliance across all test cases. |
Confidence Calibration | Output includes a confidence score between 0.0 and 1.0 that correlates with evidence completeness. Low-confidence outputs include explicit uncertainty statements. | Confidence score of 1.0 when key evidence is missing or ambiguous. High confidence on clearly ambiguous scenarios. | Compare confidence scores against human-labeled difficulty ratings for each golden case. Calculate correlation. Flag cases where confidence > 0.8 but human label is 'ambiguous'. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single pod eviction event and minimal cluster context. Focus on getting a coherent eviction chain explanation without strict schema enforcement. Replace [CLUSTER_STATE] with a simplified node summary and [POD_EVENTS] with raw kubectl describe pod output.
Watch for
- The model may hallucinate resource metrics if not provided
- Eviction reason classification may be overly broad without node condition details
- Priority preemption chains may be invented if PodPriority data is missing

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us