# rsidarte/k8s-pod-analyzer architecture

> Architecture diagram of the GitHub repository rsidarte/k8s-pod-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rsidarte/k8s-pod-analyzer
- Repository: https://github.com/rsidarte/k8s-pod-analyzer

## Overview

k8s-pod-analyzer reports Kubernetes pod health from saved JSON and can separately diagnose problematic pods from a live cluster using Claude. The documented workflows are file-based reporting and live-cluster diagnosis; the shared counting helper supports report aggregation. The GitHub API script is outside the README-described product. Relationships reflect the excerpts and README; no unsampled implementation is assumed.

Main entry points: [`llm.py`](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py) (Diagnosis entry), [`analyse.py`](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py) (Health report), [`pods.json`](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/pods.json) (Pod JSON), [`outils.py`](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/outils.py) (Grouping counts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs"]
  node_pod_json["Pod JSON<br/>[pods.json]"]
  node_kubectl["kubectl"]
end

subgraph group_analysis["Pod analysis"]
  node_report_entry["Report entry<br/>[analyse.py]"]
  node_pod_parsing["Pod parsing<br/>[analyse.py]"]
  node_pod_checks["Pod checks<br/>[analyse.py]"]
  node_reporting["Health report<br/>[analyse.py]"]
  node_counting["Grouping counts<br/>[outils.py]"]
end

subgraph group_diagnosis["AI diagnosis"]
  node_diagnosis_entry["Diagnosis entry<br/>[llm.py]"]
  node_pod_fetch["Live pod fetch<br/>[llm.py]"]
  node_context_build["Context building<br/>[llm.py]"]
  node_claude["Claude API"]
  node_diagnosis_output["Diagnosis output<br/>[llm.py]"]
  node_usage_cost["Usage and cost<br/>[llm.py]"]
  node_usage_history[("Usage history<br/>[llm.py]")]
end

node_operator(("Operator"))

node_operator -->|"runs report"| node_report_entry
node_operator -->|"runs diagnosis"| node_diagnosis_entry
node_pod_json -->|"provides input"| node_report_entry
node_report_entry -->|"parses JSON"| node_pod_parsing
node_pod_parsing -->|"supplies pods"| node_reporting
node_reporting -->|"checks failures"| node_pod_checks
node_reporting -->|"counts groups"| node_counting
node_diagnosis_entry -->|"fetches pods"| node_pod_fetch
node_pod_fetch -->|"runs command"| node_kubectl
node_diagnosis_entry -->|"parses response"| node_pod_parsing
node_diagnosis_entry -->|"selects pods"| node_pod_checks
node_diagnosis_entry -->|"builds context"| node_context_build
node_context_build -->|"sends prompt"| node_claude
node_diagnosis_entry -->|"prints diagnosis"| node_diagnosis_output
node_diagnosis_entry -->|"reports usage"| node_usage_cost
node_diagnosis_entry -->|"appends usage"| node_usage_history

click node_pod_json "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/pods.json"
click node_report_entry "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py"
click node_pod_parsing "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py"
click node_pod_checks "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py"
click node_reporting "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py"
click node_counting "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/outils.py"
click node_diagnosis_entry "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"
click node_pod_fetch "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"
click node_context_build "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"
click node_diagnosis_output "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"
click node_usage_cost "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"
click node_usage_history "https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py"

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_pod_json,node_kubectl toneBlue
class node_report_entry,node_pod_parsing,node_pod_checks,node_reporting,node_counting toneAmber
class node_diagnosis_entry,node_pod_fetch,node_context_build,node_claude,node_diagnosis_output,node_usage_cost,node_usage_history toneMint
class node_operator toneIndigo
```

## Components

### Inputs

- [Pod JSON](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/pods.json): `pods.json`
- **kubectl**

### Pod analysis

- [Report entry](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py): `analyse.py`
- [Pod parsing](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py): `analyse.py`
- [Pod checks](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py): `analyse.py`
- [Health report](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/analyse.py): `analyse.py`
- [Grouping counts](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/outils.py): `outils.py`

### AI diagnosis

- [Diagnosis entry](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`
- [Live pod fetch](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`
- [Context building](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`
- **Claude API**
- [Diagnosis output](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`
- [Usage and cost](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`
- [Usage history](https://github.com/rsidarte/k8s-pod-analyzer/blob/main/llm.py): `llm.py`

### Other components

- **Operator**

## Connections

- Operator → Report entry: runs report (evidence: `README.md`)
- Operator → Diagnosis entry: runs diagnosis (evidence: `README.md`)
- Pod JSON → Report entry: provides input (evidence: `README.md`)
- Report entry → Pod parsing: parses JSON (evidence: `analyse.py`)
- Pod parsing → Health report: supplies pods (evidence: `analyse.py`)
- Health report → Pod checks: checks failures (evidence: `analyse.py`)
- Health report → Grouping counts: counts groups (evidence: `analyse.py`)
- Diagnosis entry → Live pod fetch: fetches pods (evidence: `llm.py`)
- Live pod fetch → kubectl: runs command (evidence: `llm.py`)
- Diagnosis entry → Pod parsing: parses response (evidence: `llm.py`)
- Diagnosis entry → Pod checks: selects pods (evidence: `llm.py`)
- Diagnosis entry → Context building: builds context (evidence: `llm.py`)
- Context building → Claude API: sends prompt (evidence: `llm.py`)
- Diagnosis entry → Diagnosis output: prints diagnosis (evidence: `llm.py`)
- Diagnosis entry → Usage and cost: reports usage (evidence: `llm.py`)
- Diagnosis entry → Usage history: appends usage (evidence: `llm.py`)
