Vai al contenuto

Architettura

Panoramica

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["Applicazioni"]
        HA[Home Assistant]
        Immich[Immich]
        Grafana[Grafana]
        More[...]
    end

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

Flusso GitOps

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 ogni 1m
    Flux->>K8s: Apply Kustomization
    K8s-->>Flux: Status (Ready/Failed)
    alt Errore
        Flux->>Telegram: Alert errore
    end

Struttura Repository

โ”œโ”€โ”€ clusters/production/     # Entry point Flux: definisce le Kustomization
โ”‚   โ”œโ”€โ”€ secrets.yaml         # Kustomization per SOPS secrets
โ”‚   โ”œโ”€โ”€ infrastructure.yaml  # Kustomization per infrastruttura
โ”‚   โ””โ”€โ”€ apps.yaml            # Kustomization per applicazioni
โ”œโ”€โ”€ infrastructure/          # Componenti di piattaforma
โ”‚   โ”œโ”€โ”€ crds/                # Gateway API CRDs
โ”‚   โ”œโ”€โ”€ metallb/             # Load balancer L2
โ”‚   โ”œโ”€โ”€ cert-manager/        # Certificati TLS wildcard
โ”‚   โ”œโ”€โ”€ nfs-csi/             # Storage driver NFS
โ”‚   โ”œโ”€โ”€ traefik/             # Ingress controller + Gateway
โ”‚   โ”œโ”€โ”€ kube-system/         # Patch sistema (metrics-server, ecc.)
โ”‚   โ””โ”€โ”€ notifications/       # Flux โ†’ Telegram alert
โ”œโ”€โ”€ apps/                    # Applicazioni utente
โ”‚   โ”œโ”€โ”€ authentik/           # SSO / Identity Provider
โ”‚   โ”œโ”€โ”€ home-assistant/      # Domotica
โ”‚   โ”œโ”€โ”€ immich/              # Photo management
โ”‚   โ”œโ”€โ”€ grafana/             # Dashboard metriche
โ”‚   โ”œโ”€โ”€ prometheus/          # Monitoring stack
โ”‚   โ”œโ”€โ”€ gatus/               # Uptime monitoring
โ”‚   โ””โ”€โ”€ ...                  # Altre app
โ””โ”€โ”€ scripts/                 # Script di diagnostica

Dipendenze tra Kustomization

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

Flux applica le risorse nell'ordine: secrets โ†’ infrastructure โ†’ apps. Ogni livello dipende dal precedente tramite dependsOn.