aula-07 e aula-08: Cluster Talos HA na Hetzner com Autoscaler

aula-07: Criação de imagem Talos customizada na Hetzner Cloud
- Usa Talos Factory para gerar imagem ARM64/AMD64
- Inclui extensões: qemu-guest-agent, hcloud

aula-08: Provisionamento de cluster Kubernetes Talos via OpenTofu
- 3 Control Planes em HA (CAX11 ARM64)
- 1 Worker Node (CAX11 ARM64)
- Rede privada, Floating IP, Firewall
- Cluster Autoscaler para Hetzner (0-5 workers extras)
- Setup interativo com validação de pré-requisitos
- Custo estimado: ~€18/mês (base)

Também inclui:
- .gitignore para ignorar arquivos sensíveis
- CLAUDE.md com instruções do projeto
This commit is contained in:
Allyson de Paula
2025-12-27 07:12:58 -03:00
parent 7efb774be8
commit aa2bcfce46
17 changed files with 1844 additions and 27 deletions

63
aula-08/variables.tf Normal file
View File

@@ -0,0 +1,63 @@
############################################################
# Variables for Hetzner Talos Kubernetes Cluster
############################################################
# Authentication
variable "hcloud_token" {
type = string
description = "Hetzner Cloud API token"
sensitive = true
}
# Cluster Configuration
variable "environment" {
type = string
description = "Environment name (prod, staging, dev)"
default = "prod"
}
# SSH Configuration
variable "ssh_public_key" {
type = string
description = "Public SSH key for emergency access to nodes"
}
# Talos Configuration
variable "talos_image_id" {
type = number
description = "ID da imagem Talos customizada na Hetzner (criada na aula-07). Obtenha com: hcloud image list --type snapshot"
}
variable "talos_version" {
type = string
description = "Talos version to use"
default = "v1.11.2" # Match the official image version
}
# Monitoring Configuration
variable "enable_monitoring" {
type = bool
description = "Enable Victoria Metrics monitoring stack"
default = true
}
# Auto-scaling Configuration
variable "scale_up_threshold" {
type = number
description = "CPU percentage to trigger scale up"
default = 70
}
variable "scale_down_threshold" {
type = number
description = "CPU percentage to trigger scale down"
default = 30
}
# Tags for resource management
variable "custom_labels" {
type = map(string)
description = "Custom labels to add to all resources"
default = {}
}