Vai al contenuto

Architecture

Overview

graph TB
    subgraph Proxmox["Proxmox Host (192.168.178.162)"]
        subgraph Cluster["Kubernetes Cluster"]
            CP[Control Plane<br/>192.168.178.50]
            W1[Worker 1<br/>192.168.178.51]
            W2[Worker 2<br/>192.168.178.52]
        end
        ZFS[(ZFS Pools<br/>flash / spacex)]
    end

    Internet((Internet)) -->|Cloudflare DNS| Traefik
    Traefik -->|Gateway API| Apps

    subgraph Apps["Applications"]
        HA[Home Assistant]
        Immich[Immich]
        Grafana[Grafana]
        More[...]
    end

    Cluster -->|NFS-CSI| ZFS
    Flux[Flux CD] -->|GitOps| Cluster
    GitHub[GitHub Repo] -->|Pull| Flux

GitOps Flow

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant Flux as Flux CD
    participant K8s as Cluster

    Dev->>GH: git push (main)
    Flux->>GH: Poll every 1m
    Flux->>K8s: Apply Kustomization
    K8s-->>Flux: Status (Ready/Failed)
    alt Error
        Flux->>Telegram: Error alert
    end

Repository Structure

โ”œโ”€โ”€ clusters/production/     # Flux entry point: defines Kustomizations
โ”‚   โ”œโ”€โ”€ secrets.yaml         # Kustomization for SOPS secrets
โ”‚   โ”œโ”€โ”€ infrastructure.yaml  # Kustomization for infrastructure
โ”‚   โ””โ”€โ”€ apps.yaml            # Kustomization for applications
โ”œโ”€โ”€ infrastructure/          # Platform components
โ”‚   โ”œโ”€โ”€ crds/                # Gateway API CRDs
โ”‚   โ”œโ”€โ”€ metallb/             # L2 load balancer
โ”‚   โ”œโ”€โ”€ cert-manager/        # TLS wildcard certificates
โ”‚   โ”œโ”€โ”€ nfs-csi/             # NFS storage driver
โ”‚   โ”œโ”€โ”€ traefik/             # Ingress controller + Gateway
โ”‚   โ”œโ”€โ”€ kube-system/         # System patch (metrics-server, etc.)
โ”‚   โ””โ”€โ”€ notifications/       # Flux โ†’ Telegram alert
โ”œโ”€โ”€ apps/                    # User applications
โ”‚   โ”œโ”€โ”€ authentik/           # SSO / Identity Provider
โ”‚   โ”œโ”€โ”€ home-assistant/      # Home automation
โ”‚   โ”œโ”€โ”€ immich/              # Photo management
โ”‚   โ”œโ”€โ”€ grafana/             # Metrics dashboard
โ”‚   โ”œโ”€โ”€ prometheus/          # Monitoring stack
โ”‚   โ”œโ”€โ”€ gatus/               # Uptime monitoring
โ”‚   โ””โ”€โ”€ ...                  # Other apps
โ””โ”€โ”€ scripts/                 # Diagnostic scripts

Kustomization Dependencies

graph LR
    secrets[secrets] --> infrastructure
    infrastructure --> apps

Flux applies resources in order: secrets โ†’ infrastructure โ†’ apps. Each level depends on the previous one via dependsOn.