# Aula 06 - n8n via Helm (Ambiente LOCAL) Deploy do n8n workflow automation em cluster Kubernetes local usando Helm. ## Arquitetura ``` ┌───────────────────────────────────────────────────────────┐ │ Cluster Local │ │ (OrbStack/k3s/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 ```bash 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 ```bash # 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**.