Workshop completo: aulas 08-10 com Talos, n8n e GitLab na Hetzner

Aula 08 - Cluster Kubernetes HA:
- Setup interativo com OpenTofu para Talos na Hetzner
- CCM, CSI Driver, Cluster Autoscaler, Metrics Server
- NGINX Ingress com LoadBalancer (HTTP/HTTPS/SSH)

Aula 09 - n8n na Hetzner:
- Deploy via Helm com PostgreSQL e Redis
- Suporte multi-tenant com add-client.sh
- Integração com Hetzner CSI para volumes persistentes

Aula 10 - GitLab na Hetzner:
- Setup agnóstico: CloudFlare (trusted proxies) ou Let's Encrypt
- Anti-affinity para distribuir webservice/sidekiq em nós diferentes
- Container Registry e SSH via TCP passthrough
- Documentação do erro 422 e solução com trustedCIDRsForXForwardedFor

Melhorias gerais:
- READMEs atualizados com arquitetura e troubleshooting
- Scripts cleanup.sh para todas as aulas
- CLAUDE.md atualizado com contexto do projeto
This commit is contained in:
Allyson de Paula
2025-12-31 17:57:02 -03:00
parent 50dc74c1d8
commit 07b7ee62d3
35 changed files with 4665 additions and 311 deletions

View File

@@ -13,9 +13,11 @@ This is a workshop repository for teaching Docker and Kubernetes concepts, speci
- **aula-03/**: Kubernetes lesson - high availability with replicas and readiness probes
- **aula-04/**: Kubernetes lesson - NGINX Ingress with Keep Request (Lua) for zero-downtime
- **aula-05/**: Kubernetes lesson - KEDA + Victoria Metrics for metrics-based auto-scaling
- **aula-06/**: Kubernetes lesson - n8n deployment via Helm with Queue Mode (workers, webhooks, PostgreSQL, Redis)
- **aula-06/**: Kubernetes lesson - n8n deployment via Helm (LOCAL environment - Docker Desktop, minikube, kind)
- **aula-07/**: Talos Linux - creating custom Talos image for Hetzner Cloud
- **aula-08/**: OpenTofu - provisioning HA Talos Kubernetes cluster on Hetzner Cloud
- **aula-08/**: OpenTofu - provisioning HA Talos Kubernetes cluster on Hetzner Cloud with CCM and LoadBalancer
- **aula-09/**: Kubernetes lesson - n8n deployment via Helm (Hetzner Cloud with CSI Driver and multi-tenant support)
- **aula-10/**: Kubernetes lesson - GitLab deployment via Helm with Container Registry and SSH
## Running the Examples
@@ -63,12 +65,12 @@ cd aula-05
```
Installs Victoria Metrics (metrics collection), KEDA (event-driven autoscaling), and NGINX Ingress. The ScaledObject monitors metrics like unavailable pods and restart counts, automatically scaling the deployment from 5 to 30 replicas based on demand.
### Aula 06 (Kubernetes - n8n via Helm)
### Aula 06 (Kubernetes - n8n via Helm - LOCAL)
```bash
cd aula-06
./setup.sh
```
Deploys n8n workflow automation platform via Helm chart with Queue Mode architecture: main node, workers (2-5 replicas with HPA), webhooks (1-3 replicas with HPA), PostgreSQL, and Redis. Access via http://n8n.localhost (requires NGINX Ingress).
Deploys n8n workflow automation platform via Helm chart in a LOCAL Kubernetes cluster (Docker Desktop, minikube, kind). Queue Mode architecture with main node, workers (2-5 replicas with HPA), webhooks (1-3 replicas with HPA), PostgreSQL, and Redis. Access via http://n8n.localhost (requires NGINX Ingress).
### Aula 07 (Talos Linux - Custom Image)
Follow the instructions in `aula-07/README.md` to create a custom Talos Linux image on Hetzner Cloud using Talos Factory. This is a prerequisite for Aula 08.
@@ -98,8 +100,47 @@ Optional - Enable cluster autoscaling:
```
This installs the Kubernetes Cluster Autoscaler configured for Hetzner Cloud, automatically scaling workers from 1 to 5 based on pending pods.
Optional - Install Hetzner Cloud Controller Manager and NGINX Ingress with LoadBalancer:
```bash
./install-ccm.sh
./install-nginx-ingress.sh
```
This enables automatic LoadBalancer provisioning and exposes HTTP/HTTPS/SSH via a single Hetzner LoadBalancer (~$5/month).
To destroy the infrastructure: `./cleanup.sh`
### Aula 09 (Kubernetes - n8n via Helm - Hetzner Cloud)
```bash
cd aula-09
export KUBECONFIG=/path/to/aula-08/kubeconfig
./setup.sh
```
Deploys n8n workflow automation platform via Helm chart on Hetzner Cloud. Installs Hetzner CSI Driver for persistent volumes (10Gi minimum). Includes multi-tenant support with `add-client.sh` script for provisioning clients in separate namespaces.
Prerequisites:
- Completed Aula 08 (Talos cluster on Hetzner)
- Hetzner Cloud API token
### Aula 10 (Kubernetes - GitLab via Helm)
```bash
cd aula-10
./setup.sh
```
Deploys GitLab via official Helm chart with:
- Web UI at git.kube.quest
- Container Registry at registry.git.kube.quest
- SSH access via port 22 (TCP passthrough through NGINX)
- PostgreSQL, Redis, and MinIO for storage
- Resource requests of ~4GB to occupy one dedicated CAX11 worker
Prerequisites:
- Completed Aula 08 (Talos cluster)
- Hetzner CSI Driver (Aula 09)
- Hetzner CCM and NGINX Ingress with LoadBalancer (Aula 08)
- DNS configured pointing to LoadBalancer IP
To remove: `./cleanup.sh`
## App Behavior
The Node.js app (`app.js`) is intentionally designed to: