# nxd010/k3s-infrastructure architecture

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

- Interactive diagram: https://gitdiagram.com/nxd010/k3s-infrastructure
- Repository: https://github.com/nxd010/k3s-infrastructure

## Overview

This repository is a small, locally hosted Kubernetes platform for deploying and observing a web app. Its documented workflow runs from building and publishing the app image, through GitOps or direct manifest deployment into a three-node K3s cluster, to serving traffic and scaling pods; Prometheus/Grafana and load testing are supporting capabilities. The README documents most infrastructure relationships; the only sampled runtime source is the HTTP app, so unsampled infrastructure components are represented from README statements rather than inspected implementation.

Main entry points: [`Dockerfile`](https://github.com/nxd010/k3s-infrastructure/blob/main/Dockerfile) (App Image), [`app.js`](https://github.com/nxd010/k3s-infrastructure/blob/main/app.js) (HTTP App), [`k8s/deployment.yaml`](https://github.com/nxd010/k3s-infrastructure/blob/main/k8s/deployment.yaml) (App Deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Build and GitOps"]
  node_manifests["Git Manifests"]
  node_argocd["ArgoCD"]
  node_image["App Image"]
  node_registry[("Image Registry")]
end

subgraph group_cluster["Kubernetes Platform"]
  node_control["Control Plane"]
  node_workers["Worker Nodes"]
  node_scheduler["Pod Scheduler"]
  node_autoscaler["HPA"]
  node_ingress["Traefik Ingress"]
  node_deployment["App Deployment<br/>[deployment.yaml]"]
end

subgraph group_app["Application Runtime"]
  node_app["HTTP App<br/>[app.js]"]
end

subgraph group_observe["Observability and Testing"]
  node_prometheus["Prometheus"]
  node_exporters["Node Exporters"]
  node_grafana["Grafana"]
  node_loadtest(("ApacheBench"))
end

node_developer(("Developer"))
node_client(("HTTP Client"))

node_developer -->|"pushes changes"| node_manifests
node_manifests -->|"triggers sync"| node_argocd
node_argocd -->|"applies manifests"| node_control
node_developer -->|"builds image"| node_image
node_image -->|"pushes image"| node_registry
node_deployment -->|"applies workload"| node_control
node_control -->|"schedules pods"| node_scheduler
node_scheduler -->|"places pods"| node_workers
node_registry -->|"supplies image"| node_app
node_ingress -->|"routes traffic"| node_app
node_client -.->|"sends requests"| node_ingress
node_loadtest -->|"floods requests"| node_ingress
node_autoscaler -->|"scales pods"| node_scheduler
node_prometheus -->|"scrapes metrics"| node_exporters
node_grafana -->|"queries metrics"| node_prometheus

click node_image "https://github.com/nxd010/k3s-infrastructure/blob/main/Dockerfile"
click node_deployment "https://github.com/nxd010/k3s-infrastructure/blob/main/k8s/deployment.yaml"
click node_app "https://github.com/nxd010/k3s-infrastructure/blob/main/app.js"

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_manifests,node_argocd,node_image,node_registry,node_client toneBlue
class node_control,node_workers,node_scheduler,node_autoscaler,node_ingress,node_deployment toneAmber
class node_app toneMint
class node_prometheus,node_exporters,node_grafana,node_loadtest toneRose
class node_developer toneIndigo
```

## Components

### Build and GitOps

- **Git Manifests**
- **ArgoCD**
- [App Image](https://github.com/nxd010/k3s-infrastructure/blob/main/Dockerfile): `Dockerfile`
- **Image Registry**

### Kubernetes Platform

- **Control Plane**
- **Worker Nodes**
- **Pod Scheduler**
- **HPA**
- **Traefik Ingress**
- [App Deployment](https://github.com/nxd010/k3s-infrastructure/blob/main/k8s/deployment.yaml): `k8s/deployment.yaml`

### Application Runtime

- [HTTP App](https://github.com/nxd010/k3s-infrastructure/blob/main/app.js): `app.js`

### Observability and Testing

- **Prometheus**
- **Node Exporters**
- **Grafana**
- **ApacheBench**

### Other components

- **Developer**
- **HTTP Client**

## Connections

- Developer → Git Manifests: pushes changes (evidence: `README.md`)
- Git Manifests → ArgoCD: triggers sync (evidence: `README.md`)
- ArgoCD → Control Plane: applies manifests (evidence: `README.md`)
- Developer → App Image: builds image (evidence: `README.md`)
- App Image → Image Registry: pushes image (evidence: `README.md`)
- App Deployment → Control Plane: applies workload (evidence: `README.md`)
- Control Plane → Pod Scheduler: schedules pods (evidence: `README.md`)
- Pod Scheduler → Worker Nodes: places pods (evidence: `README.md`)
- Image Registry → HTTP App: supplies image (evidence: `README.md`)
- Traefik Ingress → HTTP App: routes traffic (evidence: `README.md`)
- HTTP Client → Traefik Ingress: sends requests
- ApacheBench → Traefik Ingress: floods requests (evidence: `README.md`)
- HPA → Pod Scheduler: scales pods (evidence: `README.md`)
- Prometheus → Node Exporters: scrapes metrics (evidence: `README.md`)
- Grafana → Prometheus: queries metrics (evidence: `README.md`)
