How to use AWS services, AI agents, and Kubernetes observability to investigate incidents, identify root causes, and automate safe remediation.
Kubernetes has transformed how we deploy and manage modern applications. However, operating production Kubernetes clusters still comes with significant challenges.
Imagine this scenario:
Your production application suddenly starts failing. Kubernetes pods enter CrashLoopBackOff, application latency increases, and Prometheus triggers critical alerts.
Your DevOps team now needs to:
- Identify the affected workload.
- Investigate pod status and Kubernetes events.
- Analyze application and container logs.
- Check CPU and memory utilization.
- Review recent deployment changes.
- Identify the root cause.
- Decide whether remediation is safe.
This investigation can involve multiple dashboards, command-line tools, and engineering teams.
What if an AI agent could automatically collect this information, investigate the incident, consult operational runbooks, and recommend the next action?
That is what we can build using AWS services and AI-powered automation.
In this article, we will explore a production-oriented architecture for an AI-Powered Kubernetes Incident Response System on AWS.
1. Architecture Overview
The proposed solution follows an event-driven architecture.
It receives monitoring alerts, starts an automated investigation, collects operational evidence, analyzes the incident using an AI agent, and evaluates proposed remediation through a policy engine.
The architecture uses:
- Prometheus and Alertmanager for monitoring.
- Amazon SNS and Amazon SQS for event delivery.
- AWS Lambda for event processing.
- AWS Step Functions for workflow orchestration.
- Strands Agents SDK for AI agent development.
- Amazon Bedrock for foundation models.
- Amazon Bedrock Knowledge Bases for runbook retrieval.
- Amazon EKS, Grafana, and CloudWatch for operational evidence.
- OpenTelemetry for observability.
- A policy engine and human approval for safe remediation.
Core principle: The AI agent investigates and recommends. Deterministic policies and authorized operators control production changes.
2. Why Do We Need AI-Powered Incident Response?
Traditional incident response often requires engineers to manually connect information from different systems.
For example, a pod restart alert alone does not explain why the container is failing.
The actual cause might be:
- Incorrect application configuration.
- Missing environment variables.
- Memory exhaustion.
- Failed dependency connections.
- Container image problems.
- Deployment configuration changes.
- Resource constraints.
An AI-powered investigation agent can correlate information from Kubernetes, logs, metrics, and operational documentation.
This can reduce repetitive investigation work and help engineers make decisions using better evidence.
3. Step-by-Step Architecture Workflow
Step 1: Detect Kubernetes Incidents
Prometheus collects metrics from Kubernetes workloads and infrastructure.
Alertmanager evaluates configured alert rules and sends notifications when thresholds are exceeded.
For example, consider this alert:
{ "alertname": "KubernetesPodCrashLooping", "severity": "critical", "namespace": "production", "pod": "payment-api-7d8f9c6b4-x2p9k", "cluster": "production-eks", "status": "firing", "description": "Pod restart count exceeded threshold" } This alert becomes the starting point for the incident response workflow.
Step 2: Ingest Alerts Using SNS and SQS
Amazon SNS and Amazon SQS provide the messaging layer.
A typical flow looks like this:
Prometheus | v Alertmanager | v Alert Ingestion Endpoint | v Amazon SNS | v Amazon SQS | v AWS Lambda | v Incident Processing Why use SQS?
During production outages, multiple alerts can arrive within a short period. SQS buffers incoming events and allows downstream services to process them at a controlled rate.
Lambda validates the event and checks whether the incident has already been processed.
Amazon DynamoDB can maintain incident state and support deduplication.
Example incident record:
{ "incident_id": "INC-2026-00125", "alert_name": "KubernetesPodCrashLooping", "cluster": "production-eks", "namespace": "production", "status": "investigating" } Important: SQS standard queues provide at-least-once delivery. Your consumer must be idempotent because the same message can be delivered more than once.
Step 3: Orchestrate the Workflow Using AWS Step Functions
Instead of implementing the entire incident response process inside one Lambda function, we can use AWS Step Functions.
Step Functions coordinates the individual investigation stages.
A simplified workflow:
Incident Received | v Validate Alert | v Check Duplicate Incident | v Collect Kubernetes Evidence | v Collect Logs and Metrics | v Invoke AI Agent | v Evaluate Proposed Action | v Human Approval? | v Execute Authorized Action | v Verify Recovery | v Generate Incident Report Step Functions provides:
- Workflow state management.
- Retry mechanisms.
- Error handling.
- Execution history.
- Service integrations.
- Human approval patterns.
This makes the overall system easier to maintain and troubleshoot.
Step 4: Build the AI Investigation Agent Using Strands
Now comes the intelligence layer.
We can use the Strands Agents SDK to develop an AI agent that investigates Kubernetes incidents through approved tools.
Amazon Bedrock can provide the foundation model used by the agent.
The agent can:
- Receive incident information.
- Understand the alert and affected workload.
- Retrieve Kubernetes pod and deployment information.
- Inspect relevant Kubernetes events.
- Analyze application logs.
- Review metrics and resource utilization.
- Retrieve relevant operational runbooks.
- Correlate the evidence.
- Generate a structured diagnosis.
- Recommend possible remediation.
Example investigation flow:
Incoming Alert | v Strands Investigation Agent | +----> EKS MCP Server | +----> Grafana MCP Server | +----> CloudWatch MCP Server | +----> Operational Knowledge Base | v Evidence Collection | v AI Analysis | v Root Cause Assessment | v Recommended Action The agent should return structured results rather than an unvalidated free-form command.
Example:
{ "incident_id": "INC-2026-00125", "root_cause": "Container repeatedly exits after failing to load configuration", "evidence": [ "Pod restart count increased", "Container logs show configuration loading errors", "Deployment references the expected configuration resource" ], "confidence": "medium", "recommended_action": "Review configuration changes and deployment history", "requires_human_approval": true } This structured response can be passed to the next stage of the workflow.
Step 5: Integrate Kubernetes and Observability Tools
The investigation agent needs reliable operational evidence.
We can integrate several tools.
Amazon EKS MCP Server
The EKS MCP Server provides an interface for AI agents to access supported Amazon EKS and Kubernetes information.
It can help retrieve:
- Cluster information.
- Namespace details.
- Pod status.
- Deployment information.
- Kubernetes events.
- Resource configuration.
For production investigations, restrict the agent to the required read-only capabilities.
Check the current AWS documentation for its availability, supported tools, and permissions because capabilities can evolve.
Grafana MCP Server
Grafana provides access to dashboards and metrics.
The agent can investigate:
- CPU utilization.
- Memory consumption.
- Request latency.
- Error rates.
- Pod restart trends.
- Service availability.
CloudWatch MCP Server
Amazon CloudWatch provides access to logs, metrics, and monitoring information.
This allows the agent to correlate Kubernetes symptoms with application and AWS infrastructure behavior.
Security note: Keep investigation tools read-only. Do not give the AI agent unrestricted production access. Remediation should use a separate, tightly controlled identity.
Step 6: Use Amazon Bedrock Knowledge Bases for Runbooks
Live logs and metrics are not always enough to identify the correct solution.
An AI agent also needs operational context.
For example:
- Which team owns the application?
- What are the approved deployment procedures?
- Which resource limits are expected?
- What does the incident response runbook recommend?
- Which remediation actions are prohibited?
Amazon Bedrock Knowledge Bases can help retrieve relevant operational documentation.
Useful knowledge sources include:
- Kubernetes troubleshooting guides.
- Internal incident response runbooks.
- Application deployment documentation.
- Infrastructure standards.
- Approved remediation procedures.
- Historical incident reports.
A simplified retrieval flow:
Incident Details | v Amazon Bedrock Knowledge Base | v Retrieve Relevant Runbooks | v Strands Investigation Agent | v Evidence-Based Recommendation This gives the agent access to organizational knowledge while investigating incidents.
Retrieved documents and logs must be treated as untrusted data. They should never override system instructions, authorization rules, or security policies.
4. Safe Automated Remediation: The Most Important Design Decision
Giving an AI agent unrestricted access to a production Kubernetes cluster is dangerous.
A better architecture separates investigation from remediation.
The investigation agent collects evidence using read-only access. A deterministic policy engine evaluates its proposed actions before any production changes occur.
We can introduce different levels of autonomy:
| Level | Capability | Approval |
|---|---|---|
| Level 1 | Detect and summarize incidents | Not required |
| Level 2 | Investigate and recommend fixes | Not required |
| Level 3 | Execute approved low-risk actions | Policy-controlled |
| Level 4 | Perform higher-impact remediation | Human approval |
For example, a policy engine can validate whether:
- The action is on an approved list.
- The target cluster is permitted.
- The namespace is allowed.
- The workload meets safety requirements.
- Sufficient healthy replicas exist.
- The action is within rate limits.
- Human approval is required.
Example policy:
ALLOWED_ACTIONS = { "restart_pod", "scale_deployment" } PROTECTED_NAMESPACES = { "kube-system", "security", "platform-critical" } def validate_action(action, namespace, approval): if action not in ALLOWED_ACTIONS: return False if namespace in PROTECTED_NAMESPACES: return False if action == "scale_deployment" and not approval: return False return True This is a simplified example, not a complete production authorization system.
A real implementation should validate workload ownership, controller type, live replica health, action scope, concurrency, rate limits, and IAM/RBAC permissions.
Never allow the AI agent to independently delete production namespaces, secrets, or critical infrastructure resources.
5. Human-in-the-Loop Approval
Some remediation actions are too risky to execute automatically.
For example:
- Scaling a critical production service.
- Changing deployment configuration.
- Rolling back an application release.
- Modifying infrastructure resources.
AWS Step Functions can pause the workflow while an authorized operator reviews the proposed action.
Example approval request:
{ "incident_id": "INC-2026-00125", "affected_workload": "payment-api", "namespace": "production", "proposed_action": "scale_deployment", "reason": "Observed resource pressure and elevated request latency", "expected_impact": "Increase replicas from 3 to 5", "approval_status": "pending" } The operator can review the evidence and either approve or reject the recommendation.
The system should record:
- Who approved the action.
- When approval occurred.
- What action was approved.
- Which resources were affected.
- Whether recovery was successful.
This provides accountability and an auditable remediation process.
6. Real-World Example: Investigating CrashLoopBackOff
Let's walk through a practical incident.
A payment API is running on Amazon EKS. Prometheus detects repeated container restarts and Alertmanager sends a critical alert.
Here is how our system responds.
Phase 1: Alert ingestion
SNS and SQS deliver the alert to Lambda. Lambda validates the message and creates an incident record in DynamoDB.
Phase 2: Evidence collection
The Strands investigation agent retrieves:
- Pod status and restart count.
- Kubernetes events.
- Container logs.
- Deployment configuration.
- CPU and memory metrics.
- Recent deployment changes, where available.
Phase 3: AI investigation
The agent identifies repeated configuration-loading errors in the container logs.
It correlates the errors with deployment information and retrieves the relevant operational runbook.
Phase 4: Recommendation
The agent recommends investigating the configuration reference and recent deployment changes instead of immediately restarting the pod.
Phase 5: Policy evaluation
The policy engine determines whether the proposed action is permitted.
If the action requires a configuration change, human approval is requested.
Phase 6: Recovery verification
After an authorized operator applies the fix, the workflow checks:
- Pod readiness.
- Restart count.
- Deployment health.
- Service availability.
- Application error rates.
Phase 7: Incident report
The system generates a report containing the original alert, collected evidence, diagnosis, approved action, and recovery status.
The result is a more structured incident response process with less repetitive manual investigation.
7. Monitor the AI System with OpenTelemetry
An AI-powered incident response platform also needs observability.
We should monitor not only Kubernetes but also the agent's behavior and decisions.
OpenTelemetry can help capture traces and telemetry across the workflow.
Important metrics include:
| Metric | Why it matters |
|---|---|
| Alert-to-investigation time | Measures response speed |
| Evidence collection duration | Identifies slow integrations |
| Model response latency | Tracks AI performance |
| Tool calls per incident | Helps control complexity and cost |
| Diagnosis accuracy | Measures investigation quality |
| Human approval rate | Shows how often actions need review |
| Remediation success rate | Measures safe execution |
| Mean time to resolution | Tracks operational improvement |
| Cost per investigation | Helps manage operating costs |
Historical incident replay is also useful.
We can replay previous incidents against updated agent versions to evaluate whether changes improve diagnosis quality or introduce new risks.
Reducing investigation time is valuable, but it should never come at the expense of accuracy or production safety.
8. Security Best Practices
Security must be part of the architecture from the beginning.
Here are some important controls:
1. Least-privilege access
Use IAM and Kubernetes RBAC to provide only the permissions required by each component.
2. Read-only investigation
Keep the AI investigation agent read-only in production wherever possible.
3. Separate remediation identity
Use a different identity for approved remediation actions.
4. Human approval
Require explicit approval for high-impact or uncertain changes.
5. Secrets protection
Avoid exposing Kubernetes secrets, credentials, and access tokens to the agent.
6. Audit logging
Record alerts, tool calls, evidence, recommendations, policy decisions, approvals, and execution results.
7. Rate limiting
Prevent repeated restarts, uncontrolled scaling, and concurrent changes to the same workload.
8. Treat logs as untrusted input
Logs and alert annotations can contain misleading or malicious text. They must be treated as data, not instructions.
9. Verify recovery
Do not mark an incident resolved just because an action completed. Confirm that the workload and application are healthy.
9. Implementation Roadmap
Building the entire system at once can introduce unnecessary complexity.
A phased implementation is more practical.
Phase 1: Alert Ingestion
- Configure Prometheus and Alertmanager.
- Integrate SNS and SQS.
- Create Lambda-based alert validation.
- Add DynamoDB incident tracking and deduplication.
Phase 2: Read-Only AI Investigation
- Configure AWS Step Functions.
- Build a Strands investigation agent.
- Integrate approved EKS, Grafana, and CloudWatch tools.
- Generate structured incident reports.
Phase 3: Knowledge Integration
- Prepare operational runbooks.
- Configure an Amazon Bedrock Knowledge Base.
- Add retrieval to the investigation workflow.
- Evaluate recommendation quality.
Phase 4: Guardrails and Approval
- Implement deterministic action policies.
- Separate investigation and remediation permissions.
- Add human approval for high-risk actions.
- Record all decisions and execution results.
Phase 5: Observability and Evaluation
- Instrument workflows with OpenTelemetry.
- Track investigation and remediation metrics.
- Replay historical incidents.
- Test failure scenarios and security boundaries.
Start with an advisory-only system. Introduce limited automation after the investigation process and safety controls have been validated.
10. AWS Services and Technologies Used
| Service / Technology | Responsibility |
|---|---|
| Amazon EKS | Kubernetes platform |
| Amazon SNS | Alert distribution |
| Amazon SQS | Reliable event buffering |
| AWS Lambda | Event processing |
| AWS Step Functions | Workflow orchestration |
| Amazon DynamoDB | Incident state and deduplication |
| Amazon Bedrock | Foundation models and AI capabilities |
| Strands Agents SDK | AI agent development |
| Amazon Bedrock Knowledge Bases | Operational runbook retrieval |
| Amazon CloudWatch | Logs and metrics |
| OpenTelemetry | Distributed tracing and telemetry |
| Prometheus | Metrics collection |
| Alertmanager | Alert management |
| Grafana | Metrics visualization |
The exact service configuration depends on your AWS environment, supported integrations, and regional availability.
11. Final Thoughts
Kubernetes incident response is not just about detecting failures. It is about understanding what happened, identifying the root cause, selecting an appropriate response, and verifying recovery.
By combining AWS event-driven services, Amazon EKS, Strands Agents, Amazon Bedrock, observability integrations, and deterministic security controls, we can build an intelligent incident response platform that reduces repetitive investigation work.
The most important design decision is controlling AI autonomy.
Let the AI agent gather evidence, correlate symptoms, consult runbooks, and recommend solutions. Let deterministic policies and authorized humans decide which production changes are permitted.
The goal is not to replace DevOps engineers. It is to give them an intelligent operational assistant that helps them respond to incidents faster, with better evidence and safer decisions.
References
- Amazon EKS MCP Server – AWS Documentation
- Strands Agents SDK
- Amazon Bedrock Documentation
- Amazon Bedrock Knowledge Bases
- AWS Step Functions Developer Guide
- Amazon SQS Developer Guide
- Kubernetes Health Checks and Probes
- Amazon EKS Observability Best Practices
- OpenTelemetry Documentation
Disclaimer: This article describes a reference architecture and illustrative implementation patterns. Validate service availability, permissions, integrations, and operational controls in your own AWS environment before deploying to production.



![Laravel 13 Puts #[Table] on Your Models. PHP Won't Load That Class Until newInstance()](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcz4ytbajureytql7wwi4.jpg)
