# atharvasss/ai-k8s-incident-response architecture

> Architecture diagram of the GitHub repository atharvasss/ai-k8s-incident-response, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atharvasss/ai-k8s-incident-response
- Repository: https://github.com/atharvasss/ai-k8s-incident-response

## Overview

This repository demonstrates a Kubernetes incident-response workflow: operators observe a simulated failure, investigate metrics and centralized logs, use an AI analyzer for remediation guidance, and verify recovery. The README documents the observability and recovery stages; the sampled analyzer reads incident data and calls a local Ollama endpoint. The collector script and Kubernetes manifests are not sampled, so their detailed behavior and connections cannot be verified here.

Main entry points: [`k8s/app.yaml`](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml) (Kubernetes Cluster), [`elastic-values.yaml`](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/elastic-values.yaml) (Elasticsearch), [`scripts/ai_analyzer.py`](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/scripts/ai_analyzer.py) (AI Analyzer), [`incident-data/incident.txt`](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/incident-data/incident.txt) (Simulated Failure)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cluster["Kubernetes Workload"]
  node_k8s["Kubernetes Cluster<br/>[app.yaml]"]
  node_app["Demo Application<br/>[app.yaml]"]
  node_loggen["Log Generator<br/>[log-generator.yaml]"]
  node_incident["Simulated Failure<br/>[incident.txt]"]
end

subgraph group_observe["Observability"]
  node_promgraf["Prometheus / Grafana"]
end

subgraph group_logs["Log Investigation"]
  node_elastic[("Elasticsearch")]
  node_kibana["Kibana<br/>[kibana-values.yaml]"]
end

subgraph group_analysis["AI Analysis"]
  node_collector["Incident Collector"]
  node_evidence["Incident Evidence<br/>[incident.txt]"]
  node_analyzer["AI Analyzer<br/>[ai_analyzer.py]"]
  node_ollama["Local Ollama"]
end

subgraph group_recovery["Recovery"]
  node_verify["Recovery Verification<br/>[app.yaml]"]
end

node_operator(("Operator"))

node_operator -->|"triggers"| node_incident
node_incident -->|"causes failure"| node_app
node_app -->|"runs in"| node_k8s
node_k8s -->|"observed with"| node_promgraf
node_app -->|"logs centralized"| node_elastic
node_k8s -->|"logs centralized"| node_elastic
node_elastic -->|"visualized in"| node_kibana
node_operator -->|"collects evidence"| node_collector
node_analyzer -->|"reads"| node_evidence
node_analyzer -->|"requests analysis"| node_ollama
node_operator -->|"checks recovery"| node_verify

click node_k8s "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml"
click node_app "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml"
click node_loggen "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/log-generator.yaml"
click node_incident "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/incident-data/incident.txt"
click node_elastic "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/elastic-values.yaml"
click node_kibana "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/kibana-values.yaml"
click node_collector "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/scripts/collect_incident.sh"
click node_evidence "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/incident-data/incident.txt"
click node_analyzer "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/scripts/ai_analyzer.py"
click node_verify "https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_k8s,node_app,node_loggen,node_incident toneBlue
class node_promgraf toneAmber
class node_elastic,node_kibana toneMint
class node_collector,node_evidence,node_analyzer,node_ollama toneRose
class node_verify,node_operator toneIndigo
```

## Components

### Kubernetes Workload

- [Kubernetes Cluster](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml): `k8s/app.yaml`
- [Demo Application](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml): `k8s/app.yaml`
- [Log Generator](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/log-generator.yaml): `k8s/log-generator.yaml`
- [Simulated Failure](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/incident-data/incident.txt): `incident-data/incident.txt`

### Observability

- **Prometheus / Grafana**

### Log Investigation

- [Elasticsearch](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/elastic-values.yaml): `elastic-values.yaml`
- [Kibana](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/kibana-values.yaml): `kibana-values.yaml`

### AI Analysis

- [Incident Collector](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/scripts/collect_incident.sh): `scripts/collect_incident.sh`
- [Incident Evidence](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/incident-data/incident.txt): `incident-data/incident.txt`
- [AI Analyzer](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/scripts/ai_analyzer.py): `scripts/ai_analyzer.py`
- **Local Ollama**

### Recovery

- [Recovery Verification](https://github.com/atharvasss/ai-k8s-incident-response/blob/master/k8s/app.yaml): `k8s/app.yaml`

### Other components

- **Operator**

## Connections

- Operator → Simulated Failure: triggers (evidence: `README.md`)
- Simulated Failure → Demo Application: causes failure (evidence: `README.md`)
- Demo Application → Kubernetes Cluster: runs in (evidence: `README.md`)
- Kubernetes Cluster → Prometheus / Grafana: observed with (evidence: `README.md`)
- Demo Application → Elasticsearch: logs centralized (evidence: `README.md`)
- Kubernetes Cluster → Elasticsearch: logs centralized (evidence: `README.md`)
- Elasticsearch → Kibana: visualized in (evidence: `README.md`)
- Operator → Incident Collector: collects evidence (evidence: `README.md`)
- AI Analyzer → Incident Evidence: reads (evidence: `scripts/ai_analyzer.py`)
- AI Analyzer → Local Ollama: requests analysis (evidence: `scripts/ai_analyzer.py`)
- Operator → Recovery Verification: checks recovery (evidence: `README.md`)
