dapper-cluster CLAUDE.md
This is a GitOps-managed Kubernetes home cluster running on Talos Linux with Flux CD for automated deployments. The infrastructure follows Infrastructure as Code (IaC) principles with comprehensive monitoring, automation, and self-healing capabilities.
Dapper Cluster - Home Operations Repository
Overview
This is a GitOps-managed Kubernetes home cluster running on Talos Linux with Flux CD for automated deployments. The infrastructure follows Infrastructure as Code (IaC) principles with comprehensive monitoring, automation, and self-healing capabilities.
Repository Structure
Core Directories
kubernetes/- Main Kubernetes manifests and configurationsdocs/- Documentation built with mdBookmemory-bank/- Claude Code memory files for context persistencescripts/- Utility scripts for cluster operationsresource-recommendations/- VPA and resource optimization data
Kubernetes Applications Structure (kubernetes/apps/)
actions-runner-system/- GitHub Actions self-hosted runnersai/- AI/ML workloads (LiteLLM, n8n, Ollama, Open WebUI, Wyoming Whisper)cert-manager/- TLS certificate managementdatabase/- Database services (CloudNative-PG, Dragonfly Redis, EMQX)default/- Default namespace applicationsexternal-secrets/- External secrets managementflux-system/- Flux CD GitOps operatorhome-automation/- Home automation stack (ESPHome, Home Assistant, Node-RED, Zigbee2MQTT)kube-system/- Core Kubernetes system componentskyverno/- Policy engine for Kubernetesmedia/- Media server stack (Plex, *arr apps, Overseerr, etc.)network/- Networking components (Ingress, DNS, SMTP relay)observability/- Monitoring stack (Prometheus, Grafana, Loki, Gatus)openebs-system/- OpenEBS storage systemsecurity/- Security applications (Authentik, Vaultwarden)selfhosted/- Self-hosted applications (Actual, Atuin, Paperless-NGX, etc.)storage/- Storage providers and volume managementsystem-upgrade/- Automated system upgrades
Key Patterns
Common Components Pattern
IMPORTANT: All namespace-level kustomizations should inherit common components by including:
components:
- ../../flux/components/common
The common components at /kubernetes/flux/components/common/ provide:
- Namespace creation
- Shared repository definitions (app-template, etc.)
- SOPS secret management configuration
- Centralized cluster configuration via substitutions
Adding a New Application
- Create namespace directory under
/kubernetes/apps/<namespace>/ - Create namespace
kustomization.yamlwith:apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: <namespace> components: - ../../flux/components/common # Always include this! resources: - ./<app-name>/ks.yaml - Add
ks.yamldefining the Flux Kustomization - Create
app/subdirectory with:helmrelease.yamlfor Helm chart deploymentkustomization.yamllisting all resources- Any additional resources (secrets, configmaps, etc.)
Standard File and Folder Naming Conventions
Application Directory Structure
Each application follows this standardized structure:
/kubernetes/apps/<namespace>/<app-name>/
├── ks.yaml # Flux Kustomization (sync definition)
├── app/ # Main application resources
│ ├── kustomization.yaml # Lists all app resources
│ ├── helmrelease.yaml # HelmRelease + HelmRepository
│ ├── helm/ # Helm configuration (if needed)
│ │ ├── values.yaml # Helm values
│ │ └── kustomizeconfig.yaml # Kustomize configuration
│ ├── secrets.sops.yaml # Encrypted secrets (optional)
│ ├── configmap.yaml # ConfigMaps (optional)
│ └── <custom-resources>.yaml # Additional K8s resources
├── gateway/ # Gateway resources (if app exposes services)
│ ├── kustomization.yaml # Lists gateway resources
│ ├── certificate.yaml # TLS certificates
│ ├── external.yaml # External gateway
│ └── internal.yaml # Internal gateway
└── <component>/ # Additional components (optional)
├── kustomization.yaml
└── <resources>.yaml
File Naming Standards
Core Infrastructure Files
ks.yaml: Flux Kustomization (always at app root level)kustomization.yaml: Kustomize resource lists (in each directory)helmrelease.yaml: Combined HelmRepository + HelmRelease definitionsvalues.yaml: Helm chart values (inhelm/subdirectory)kustomizeconfig.yaml: Kustomize configuration (inhelm/subdirectory)
Security and Configuration
secret.sops.yaml: SOPS-encrypted secrets (single resource)secrets.sops.yaml: SOPS-encrypted secrets (multiple resources)configmap.yaml: Application configurationnamespace.yaml: Namespace definitions (when not using common components)
Network and Gateway Resources
certificate.yaml: TLS certificate definitionsexternal.yaml: External-facing Gateway resourcesinternal.yaml: Internal Gateway resourcesnetworks.yaml: Network policy and load balancer configurationshttproute.yaml: HTTP routing definitionsdnsendpoint.yaml: External DNS endpoint configurationsgatewayclass.yaml: Gateway class definitionsenvoyproxy.yaml: Envoy proxy configurationssecurity-policy.yaml: Security policies (OIDC, CORS, rate limiting)
Storage and Backup
pvc.yaml: PersistentVolumeClaim definitionsstorageclass.yaml: StorageClass definitionsschedule.yaml: K8up backup schedulescheck.yaml: Backup integrity checksprune.yaml: Backup pruning configurations
Cluster Management
clusterissuer.yaml: cert-manager ClusterIssuer definitionsreceiver.yaml: Flux webhook receiverscrds.yaml: Custom Resource Definitions (often just comments referencing Helm)
Resource Type Placement
By Directory Structure
- Flux Resources:
ks.yamlfiles at app/component root - Helm Charts:
helmrelease.yamlinapp/directory - Helm Values:
helm/values.yamlwithhelm/kustomizeconfig.yaml - Secrets:
secret.sops.yamlorsecrets.sops.yaml(always encrypted with SOPS) - Gateway/Ingress: Separate
gateway/subdirectory for apps with external access - Network Policies:
networks.yamlfor CNI-specific configurations - Custom Resources: Named by resource type (e.g.,
serviceaccount.yaml,rbac.yaml)
By Resource Category
- Storage Resources:
pvc.yaml,storageclass.yamlin storage applications - Security Policies:
security-policy.yamlfor authentication, authorization, CORS - DNS/Networking:
dnsendpoint.yaml,httproute.yamlfor external connectivity - Backup Resources:
schedule.yaml,check.yaml,prune.yamlfor K8up operations - Certificate Management:
clusterissuer.yaml,certificate.yamlfor TLS - Monitoring/Observability: Resources often embedded in
envoyproxy.yamlor separate files
Multi-Component Applications
For complex applications with multiple components (like Cilium with app + gateway):
<app-name>/
├── ks.yaml # Primary component Kustomization
├── app/ # Main application
│ └── ...
├── <component>/ # Additional component (e.g., gateway)
│ ├── kustomization.yaml
│ └── ...
└── <component>/ # Another component
├── kustomization.yaml
└── ...
Bootstrap & Configuration (kubernetes/bootstrap/)
talos/- Talos Linux cluster configurationclusterconfig/- Node-specific configurationspatches/- Cluster patches and customizationstalconfig.yaml- Main Talos configuration
apps/- Helmfile for initial application deployment
Flux Configuration (kubernetes/flux/)
cluster/- Cluster-wide Flux resourcescomponents/- Reusable components and templatesmeta/- Helm repositories and metadata
Key Technologies
- OS: Talos Linux (immutable Kubernetes-focused OS)
- GitOps: Flux CD v2
- Networking: Cilium CNI with L2 announcements
- Storage: OpenEBS for local storage, CSI NFS driver for NAS
- Monitoring: Prometheus, Grafana, Loki, Promtail
- Security: Authentik (SSO), Vaultwarden, cert-manager
- Secrets: External Secrets Operator with SOPS/age encryption
- Automation: Renovate for dependency updates
Common Tasks
Cluster Operations
# Check cluster status
task kubernetes:check
# Apply Kubernetes resources
task kubernetes:apply
# View cluster resources
task resources:summary
Talos Operations
# Generate Talos configuration
task talos:genconfig
# Apply Talos configuration
task talos:apply
# Bootstrap cluster
task talos:bootstrap
Volume Management
# Unlock VolSync volumes
task volsync:unlock
# List VolSync jobs
task volsync:list
Application Categories
Media Stack
Complete media automation with Plex, Sonarr, Radarr, Prowlarr, Overseerr, and related tools for both standard and UHD content.
Home Automation
Comprehensive home automation using Home Assistant, ESPHome, Node-RED, and Zigbee2MQTT for device management.
AI/ML Services
Local AI inference with Ollama, LiteLLM proxy, Open WebUI, and automation workflows via n8n.
Observability
Full-stack monitoring with Prometheus metrics, Grafana dashboards, Loki logging, and Gatus uptime monitoring.
Self-hosted Applications
Various productivity and utility applications including Paperless-NGX, Actual budget, Atuin shell history, and more.
External Integrations
- DNS: External DNS with Cloudflare
- Ingress: NGINX ingress controllers (internal/external)
- Certificates: Let's Encrypt via cert-manager
- Monitoring: Kromgo for external status reporting
- Secrets: Infisical for secret management
Security Features
- Age-encrypted secrets with SOPS
- Authentik SSO for application access
- Network policies via Cilium
- Pod security standards enforcement
- Regular automated security updates
Backup Strategy
- VolSync for application data replication
- PostgreSQL automated backups via CloudNative-PG
- Configuration stored in Git for disaster recovery
This cluster represents a production-ready home lab environment with enterprise-grade tooling and practices scaled for personal use.
Important Notes
- Never commit unencrypted secrets
- Always test Talos config changes on a single node first
- Use
task reconcileto force immediate Git sync - Check
flux get all -Abefore assuming changes aren't applied - The cluster uses GitHub webhook for instant updates (configured separately)
- API Gateway: Envoy Gateway is configured for microservices with OIDC authentication
- Gateway Routes: Use HTTPRoute resources to expose services through the API gateway