# the0mikkel/hetzner-k3s architecture

> Architecture diagram of the GitHub repository the0mikkel/hetzner-k3s, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/the0mikkel/hetzner-k3s
- Repository: https://github.com/the0mikkel/hetzner-k3s

## Overview

##### Main Components

a) Infrastructure Layer:
- Hetzner Cloud Platform
- Network Infrastructure
- Node Groups (Control Plane and Worker Nodes)

b) Kubernetes Layer:
- k3s Distribution
- Core Components
- Storage System

c) Application Layer:
- ArgoCD (Continuous Delivery)
- Ingress Controller
- Monitoring (Prometheus)
- Database (PostgreSQL Operator)
- Certificate Management (cert-manager)
- Sample Applications (hello-world)

**┌─────────────────────────────────────────┐**
- Hetzner Cloud                │
- ┘

**┌─────────────────┐    ┌─────────────────┐**
- Terraform    │    │   hetzner-k3s   │
- Approach     │    │    Approach     │
- ┘    └─────────────────┘

**┌─────────────────────────────────────────┐**
- k3s Cluster                │
- ┌──────────┐ ┌──────────┐ ┌──────────┐ │
- ArgoCD   │ │ Ingress  │ │  Cert-   │ │
- ┘ └──────────┘ │ Manager  │ │
- ┌──────────┐ ┌──────────┐ └──────────┘ │
- Prometheus│ │PostgreSQL│              │
- ┘ └──────────┘              │
- ┘

**🔷 Cloud Infrastructure**
**🔶 Management Tools**
**🔰 Kubernetes Components**
**🔮 Application Services**
**→  Direct Connection**
**⟢  Deployment Flow**

##### Additional Details

- Version control integration (Git repository)
- Configuration management flow
- Backup and snapshot management (reference to hcloud-microos-snapshots.pkr.hcl)
- Network flow between components
- Security boundaries and access controls

##### Important Relationships to Highlight

- Terraform/hetzner-k3s → Hetzner Cloud API
- Infrastructure → k3s Cluster
- ArgoCD → Application Deployments
- Ingress → External Access
- Cert-Manager → TLS/Security
- Prometheus → Monitoring Flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Cloud["Hetzner Cloud Platform"]
        API[API Interface]:::cloud
        Network[Network Infrastructure]:::cloud
    end

    subgraph Deployment["Deployment Approaches"]
        TF["Terraform Deployment"]:::management
        HK["Hetzner-k3s Deployment"]:::management
        
        TFConfig["Infrastructure Config"]:::config
        HKConfig["Configuration Template"]:::config
        TFVars["Variables Template"]:::config
        Snapshot["Snapshot Management"]:::config
    end

    subgraph K8s["Kubernetes Layer (k3s)"]
        subgraph Core["Core Components"]
            CP[Control Plane]:::k8s
            WN[Worker Nodes]:::k8s
        end

        subgraph Apps["Application Services"]
            ARGO[ArgoCD]:::app
            ING[Ingress Controller]:::app
            CERT["Cert-Manager"]:::app
            PROM[Prometheus]:::app
            PSQL[PostgreSQL Operator]:::app
            HELLO[Hello World App]:::app
        end
    end

    %% Relationships
    API --> Network
    TF --> API
    HK --> API
    
    TF --> TFConfig
    TF --> TFVars
    TF --> Snapshot
    HK --> HKConfig
    
    Network --> CP
    Network --> WN
    
    CP --> ARGO
    CP --> ING
    CP --> CERT
    CP --> PROM
    CP --> PSQL
    
    ARGO --> HELLO
    ING --> HELLO
    CERT --> ING

    %% Click Events
    click HK "https://github.com/The0mikkel/hetzner-k3s/tree/main/hetzner-k3s"
    click HKConfig "https://github.com/The0mikkel/hetzner-k3s/blob/main/hetzner-k3s/template.yml"
    click TF "https://github.com/The0mikkel/hetzner-k3s/tree/main/terraform/cluster"
    click TFConfig "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/cluster/kube.tf"
    click Snapshot "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/cluster/hcloud-microos-snapshots.pkr.hcl"
    click ARGO "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/argocd.tf"
    click CERT "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/cert-manager.tf"
    click ING "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/ingress.tf"
    click PSQL "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/postgres-operator.tf"
    click PROM "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/prometheus.tf"
    click HELLO "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/content/hello-world.tf"
    click TFVars "https://github.com/The0mikkel/hetzner-k3s/blob/main/terraform/cluster/tfvars/template.tfvars"

    %% Styling
    classDef cloud fill:#b3e0ff,stroke:#0066cc
    classDef management fill:#ffd9b3,stroke:#ff8000
    classDef k8s fill:#d9f2d9,stroke:#339933
    classDef app fill:#e6ccff,stroke:#6600cc
    classDef config fill:#ffcccc,stroke:#ff0000

    %% Legend
    subgraph Legend
        L1[Cloud Components]:::cloud
        L2[Management Tools]:::management
        L3[Kubernetes Components]:::k8s
        L4[Application Services]:::app
        L5[Configuration Files]:::config
    end
```
