Files
kube-wordpress/GEMINI.md
2026-01-18 18:00:41 +01:00

2.1 KiB

Role

Sei un esperto SRE e Security Architect Kubernetes. Genera manifest YAML per un'architettura WordPress multi-tenant ultra-sicura.

Context

  • Namespace: wordpress.
  • Ingress Controller: Traefik (usando le CRD IngressRoute e Middleware).
  • Architettura: Multi-tenant (1 Pod, 1 Deployment, 1 PVC per ogni sito).
  • Storage: longhorn-fast.
  • Database: CloudNativePG (CNPG) (Un cluster centrale, database/user dedicati per sito).

Requirements & Security Hardening

Genera i manifest includendo:

  1. Traefik IngressRoute & Middlewares:

    • Definisci un Middleware di sicurezza standard: HSTS, rimozione header X-Powered-By, protezione XSS, nosniff, e restrizioni frameDeny.
    • Per ogni sito, crea un IngressRoute che punta al servizio WordPress.
    • Configura il TLS tramite secretName gestito da cert-manager.
  2. CloudNativePG (CNPG) Setup:

    • Definisci un Cluster PostgreSQL robusto.
    • Per ogni nuovo sito WordPress, genera la risorsa Database e User di CNPG affinché ogni sito abbia le proprie credenziali isolate.
  3. WordPress Hardening (Per Sito):

    • Immagine: wordpress:php8.2-fpm-alpine.
    • SecurityContext: runAsNonRoot: true, allowPrivilegeEscalation: false, readOnlyRootFilesystem: true.
    • Volumes:
      • PVC longhorn-fast montato su /var/www/html/wp-content.
      • emptyDir per /tmp, /var/run, e le cache di PHP/Nginx per supportare il filesystem in sola lettura.
  4. Network Isolation:

    • NetworkPolicy di tipo "Default Deny" nel namespace.
    • Regole specifiche per permettere a Traefik di parlare con i Pod WordPress e ai Pod WordPress di parlare solo con il Cluster CNPG.
  5. Resource Limits:

    • CPU: 200m-500m, RAM: 256Mi-512Mi per ogni istanza WordPress.

Output Format

Fornisci i manifest separati o raggruppati, pronti per essere applicati. Includi una sezione "Template Variabili" per permettermi di scalare facilmente l'aggiunta di nuovi siti.

Constraints

  • Usa solo HTTPS (redirect automatico gestito da Traefik).
  • Isolamento totale tra i siti: nessun Pod deve poter vedere il PVC di un altro.