a0cf1e6cef
- Corrigir tipos Hetzner: CPX não existe, usar CX (Intel shared vCPU) - CX23 (2 vCPU, 4GB) equivalente ao CAX11 - CX33 (4 vCPU, 8GB) equivalente ao CAX21 - CX43 (8 vCPU, 16GB) equivalente ao CAX31 - Corrigir location no autoscaler para amd64 (nbg1→fsn1) - Remover gitlab-pool do autoscaler (substituído pelo Gitea) - Aumentar worker-pool max para 30 - Corrigir Floating IP e Load Balancer hardcoded em nbg1 - Corrigir stdin em read interativo: usar < /dev/tty e read -p - Corrigir cleanup de namespace: lidar com Terminating e finalizers - Corrigir CNPG: nome do deployment, secret e endpointURL duplo - Aulas afetadas: 08, 09, 10, 11, 12, 14, 17
71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
apiVersion: postgresql.cnpg.io/v1
|
|
kind: Cluster
|
|
metadata:
|
|
name: shared-postgres
|
|
namespace: cnpg
|
|
spec:
|
|
imageName: ghcr.io/cloudnative-pg/postgresql:17.2-4
|
|
instances: 3
|
|
enableSuperuserAccess: true
|
|
# ── Topology-aware placement ──
|
|
# Hetzner CCM labels nodes automatically:
|
|
# topology.kubernetes.io/zone = fsn1 | nbg1 | hel1 (datacenter)
|
|
# topology.kubernetes.io/region = eu-central | hel-southeast
|
|
#
|
|
# podAntiAffinityType: required → no 2 PG pods on same node (hard constraint)
|
|
# topologyKey: kubernetes.io/hostname → spread across nodes
|
|
#
|
|
# For cross-DC spread, CNPG relies on Kubernetes scheduler topology awareness.
|
|
# With nodes in multiple zones (fsn1, nbg1, hel1), the scheduler naturally
|
|
# spreads pods when combined with the node autoscaler.
|
|
affinity:
|
|
topologyKey: kubernetes.io/hostname
|
|
podAntiAffinityType: required
|
|
storage:
|
|
size: 10Gi
|
|
storageClass: hcloud-volumes
|
|
walStorage:
|
|
size: 5Gi
|
|
storageClass: hcloud-volumes
|
|
resources:
|
|
requests:
|
|
cpu: 500m
|
|
memory: 1Gi
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
postgresql:
|
|
parameters:
|
|
max_connections: "100"
|
|
shared_buffers: "256MB"
|
|
effective_cache_size: "512MB"
|
|
work_mem: "4MB"
|
|
maintenance_work_mem: "128MB"
|
|
log_min_duration_statement: "1000"
|
|
bootstrap:
|
|
initdb:
|
|
database: app
|
|
owner: app
|
|
backup:
|
|
barmanObjectStore:
|
|
destinationPath: s3://CHANGE_BUCKET_NAME/cnpg-backups/shared-postgres
|
|
endpointURL: https://CHANGE_ENDPOINT
|
|
s3Credentials:
|
|
accessKeyId:
|
|
name: cnpg-backup-credentials
|
|
key: ACCESS_KEY_ID
|
|
secretAccessKey:
|
|
name: cnpg-backup-credentials
|
|
key: ACCESS_SECRET_KEY
|
|
wal:
|
|
compression: gzip
|
|
data:
|
|
compression: gzip
|
|
jobs: 2
|
|
retentionPolicy: "30d"
|
|
monitoring:
|
|
enablePodMonitor: true
|
|
startDelay: 3600
|
|
livenessProbeTimeout: 90
|
|
primaryUpdateStrategy: unsupervised
|
|
primaryUpdateMethod: switchover |