Files
workshop/aula-06/README.md
Allyson de Paula 07b7ee62d3 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
2025-12-31 17:57:02 -03:00

5.2 KiB

Aula 06 - n8n via Helm (Ambiente LOCAL)

Deploy do n8n workflow automation em cluster Kubernetes local usando Helm.

Arquitetura

┌─────────────────────────────────────────────────────────────┐
│                    Cluster Local                             │
│  (Docker Desktop / minikube / kind / k3d)                   │
│                                                              │
│  ┌─────────────────────────────────────────────────────┐    │
│  │                 NGINX Ingress                        │    │
│  │              http://n8n.localhost                    │    │
│  └────────────────────────┬────────────────────────────┘    │
│                           │                                  │
│  ┌────────────────────────┼────────────────────────────┐    │
│  │               Namespace: n8n                         │    │
│  │                         │                            │    │
│  │    ┌────────────────────┼────────────────────┐      │    │
│  │    │                    ▼                    │      │    │
│  │    │              ┌──────────┐               │      │    │
│  │    │              │   Main   │               │      │    │
│  │    │              │  (n8n)   │               │      │    │
│  │    │              └────┬─────┘               │      │    │
│  │    │                   │                     │      │    │
│  │    │     ┌─────────────┼─────────────┐      │      │    │
│  │    │     ▼             ▼             ▼      │      │    │
│  │    │ ┌───────┐   ┌──────────┐   ┌────────┐ │      │    │
│  │    │ │Workers│   │ Webhooks │   │  MCP   │ │      │    │
│  │    │ │ (2-5) │   │  (1-3)   │   │Webhook │ │      │    │
│  │    │ └───────┘   └──────────┘   └────────┘ │      │    │
│  │    │                                        │      │    │
│  │    │              Queue Mode                │      │    │
│  │    └────────────────────────────────────────┘      │    │
│  │                         │                           │    │
│  │         ┌───────────────┼───────────────┐          │    │
│  │         ▼                               ▼          │    │
│  │    ┌──────────┐                   ┌──────────┐    │    │
│  │    │PostgreSQL│                   │  Redis   │    │    │
│  │    │  (1Gi)   │                   │  (1Gi)   │    │    │
│  │    └──────────┘                   └──────────┘    │    │
│  └─────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────┘

Pré-requisitos

  • Cluster Kubernetes local:
    • Docker Desktop com Kubernetes habilitado
    • minikube (minikube start)
    • kind (kind create cluster)
    • k3d (k3d cluster create)
  • kubectl configurado
  • Helm 3.x instalado

Instalação

cd aula-06
chmod +x setup.sh
./setup.sh

O script instala automaticamente:

  1. NGINX Ingress Controller
  2. n8n com todos os componentes

Acesso

URL: http://n8n.localhost

Se n8n.localhost não resolver, adicione ao /etc/hosts:

127.0.0.1 n8n.localhost

Componentes

Componente Réplicas Recursos
Main (n8n) 1 256Mi-1Gi RAM
Workers 2-5 (HPA) 256Mi-512Mi RAM
Webhooks 1-3 (HPA) 128Mi-256Mi RAM
PostgreSQL 1 1Gi volume
Redis 1 1Gi volume

Comandos Úteis

# Ver pods
kubectl get pods -n n8n

# Ver logs do n8n
kubectl logs -f -n n8n deployment/n8n

# Ver autoscaling
kubectl get hpa -n n8n

# Desinstalar
helm uninstall n8n -n n8n
kubectl delete ns n8n

Para Cluster Hetzner Cloud

Se você quer fazer deploy em um cluster Hetzner Cloud com volumes persistentes e LoadBalancer, veja a aula-09.