# βœ… AiWorker Kubernetes Cluster - Setup Completo **Fecha**: 2026-01-19 **Estado**: βœ… ProducciΓ³n Ready ## 🎯 Resumen del Cluster ### Infraestructura Desplegada | Componente | Cantidad | Plan | Specs | IP PΓΊblica | IP Privada | |------------------|----------|------------|--------------------------|------------------|-------------| | Control Planes | 3 | gp.starter | 4 vCPU, 8 GB RAM | 108.165.47.x | 10.100.0.2-4| | Workers | 3 | gp.small | 8 vCPU, 16 GB RAM | 108.165.47.x | 10.100.0.5-7| | Load Balancers | 2 | gp.micro | 2 vCPU, 4 GB RAM | 221, 203 | 10.100.0.8-9| | **Total** | **8** | | **48 vCPU, 104 GB RAM** | | | ### Software Stack | Componente | VersiΓ³n | Estado | PropΓ³sito | |-------------------------|--------------|--------|-------------------------------------| | K3s | v1.35.0+k3s1 | βœ… | Kubernetes distribution | | Nginx Ingress | latest | βœ… | HTTP/HTTPS routing | | Cert-Manager | v1.16.2 | βœ… | TLS certificates automation | | ArgoCD | stable | βœ… | GitOps continuous delivery | | HAProxy | 2.8.16 | βœ… | Load balancing (on LB nodes) | | Metrics Server | included | βœ… | Resource metrics | | CoreDNS | included | βœ… | Cluster DNS | | Local Path Provisioner | included | βœ… | Dynamic storage | ## 🌐 Arquitectura de Red ``` Internet ↓ [DNS: *.fuq.tv] ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” ↓ ↓ [LB-01: .221] [LB-02: .203] HAProxy HA HAProxy HA ↓ ↓ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ [Private Network 10.100.0.0/24] ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” ↓ ↓ ↓ [CP-01: .2] [CP-02: .3] [CP-03: .4] K3s + etcd K3s + etcd K3s + etcd ↓ ↓ ↓ ─────┴───────────────────┴───────────────────┴───── ↓ ↓ ↓ [Worker-01: .5] [Worker-02: .6] [Worker-03: .7] Nginx Ingress Nginx Ingress Nginx Ingress ↓ ↓ ↓ [Pods] [Pods] [Pods] ``` ## πŸ” Accesos ### Kubernetes ```bash # Kubeconfig export KUBECONFIG=~/.kube/aiworker-config # Comandos kubectl get nodes kubectl get pods -A kubectl get ingress -A ``` ### ArgoCD - **URL**: https://argocd.fuq.tv - **Usuario**: admin - **Password**: `LyPF4Hy0wvp52IoU` ### HAProxy Stats - **LB-01**: http://108.165.47.221:8404/stats - **LB-02**: http://108.165.47.203:8404/stats - **Credentials**: admin / aiworker2026 ## πŸ“‹ DNS ConfiguraciΓ³n **Configurado en fuq.tv:** ``` *.fuq.tv A 108.165.47.221 *.fuq.tv A 108.165.47.203 *.r.fuq.tv A 108.165.47.221 *.r.fuq.tv A 108.165.47.203 ``` **Subdominios disponibles:** - `app.fuq.tv` - Dashboard frontend - `api.fuq.tv` - Backend API - `git.fuq.tv` - Gitea server - `argocd.fuq.tv` - ArgoCD UI - `*.r.fuq.tv` - Preview environments (task-123.r.fuq.tv) ## πŸ§ͺ VerificaciΓ³n ### Test Application ```bash # HTTP (redirect a HTTPS) curl http://test.fuq.tv # HTTPS con TLS curl https://test.fuq.tv # Verificar certificado curl -v https://test.fuq.tv 2>&1 | grep "issuer" ``` ### Cluster Health ```bash # Nodes kubectl get nodes -o wide # System pods kubectl get pods -A # Certificates kubectl get certificate -A # Ingresses kubectl get ingress -A ``` ## πŸ“ Namespaces Creados | Namespace | PropΓ³sito | Resource Quota | |-----------------|----------------------------------------|-----------------------| | control-plane | Backend, API, MySQL, Redis | 8 CPU, 16 GB RAM | | agents | Claude Code agent pods | 20 CPU, 40 GB RAM | | gitea | Git server | 2 CPU, 4 GB RAM | | monitoring | Prometheus, Grafana (futuro) | - | | argocd | GitOps controller | - | | ingress-nginx | Ingress controller | - | | cert-manager | TLS management | - | ## πŸ’° Costos Mensuales ``` Control Planes: 3 Γ— $15 = $45 Workers: 3 Γ— $29 = $87 Load Balancers: 2 Γ— $8 = $16 ───────────────────────────── Total: $148/mes ``` ## πŸ”„ Alta Disponibilidad βœ… **Control Plane**: 3 nodos con etcd distribuido - tolera 1 fallo βœ… **Workers**: 3 nodos - workload distribuido βœ… **Load Balancers**: 2 nodos con DNS round-robin - tolera 1 fallo βœ… **Ingress**: Corriendo en todos los workers - redundante βœ… **Storage**: Local path provisioner en cada nodo ## πŸš€ PrΓ³ximos Pasos 1. **Desplegar Gitea** ```bash kubectl apply -f k8s/gitea/ ``` 2. **Desplegar Backend** ```bash kubectl apply -f k8s/backend/ ``` 3. **Desplegar Frontend** ```bash kubectl apply -f k8s/frontend/ ``` 4. **Configurar ArgoCD** - Conectar repositorio Git - Crear Applications - Configurar auto-sync ## πŸ“ Archivos Importantes - `CLUSTER-CREDENTIALS.md` - Credenciales y accesos (⚠️ NO COMMITEAR) - `k8s-cluster-info.md` - Info tΓ©cnica del cluster - `scripts/install-k3s-cluster.sh` - Script instalaciΓ³n completa - `scripts/setup-load-balancers.sh` - Script configuraciΓ³n LBs - `docs/` - DocumentaciΓ³n completa del proyecto ## πŸ”§ Mantenimiento ### Backup etcd ```bash ssh root@108.165.47.233 "k3s etcd-snapshot save" ``` ### Actualizar K3s ```bash # En cada nodo (empezar por workers, luego control planes) ssh root@ "curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.X.X+k3s1 sh -" ``` ### Monitoreo ```bash # Resource usage kubectl top nodes kubectl top pods -A # Logs kubectl logs -f -n # Events kubectl get events -A --sort-by='.lastTimestamp' ``` ## πŸŽ‰ Estado Final **Cluster Status**: βœ… Production Ready **Capacidad Total**: - 48 vCPUs - 104 GB RAM - ~2.5 TB Storage - HA en todos los componentes crΓ­ticos **Probado**: - βœ… Cluster HA funcional - βœ… Nginx Ingress routing - βœ… TLS automΓ‘tico con Let's Encrypt - βœ… DNS resolution - βœ… Load balancing - βœ… Private network communication **Listo para**: - βœ… Desplegar aplicaciones - βœ… GitOps con ArgoCD - βœ… Auto-scaling de pods - βœ… Certificados TLS automΓ‘ticos - βœ… Preview environments --- **Β‘Cluster AiWorker listo para producciΓ³n! πŸš€**