diff --git a/aula-12/README.md b/aula-12/README.md index 1760a3b..4b16e79 100644 --- a/aula-12/README.md +++ b/aula-12/README.md @@ -410,34 +410,40 @@ Expansão automática de volumes quando atingirem 80% da capacidade. # Adicionar repo Helm helm repo add pvc-autoresizer https://topolvm.github.io/pvc-autoresizer/ -# Instalar com Victoria Metrics como fonte de métricas +# Instalar com Victoria Metrics + modo automático (sem annotations) helm install pvc-autoresizer pvc-autoresizer/pvc-autoresizer \ --namespace pvc-autoresizer \ --create-namespace \ - --set controller.args.prometheusURL=http://vmsingle-monitoring-victoria-metrics-k8s-stack.monitoring:8429 + --set controller.args.prometheusURL=http://vmsingle-monitoring-victoria-metrics-k8s-stack.monitoring:8429 \ + --set controller.args.noAnnotationCheck=true \ + --set controller.args.initialResizeGroupByPvc=true # Habilitar auto-resize no StorageClass kubectl annotate storageclass hcloud-volumes resize.topolvm.io/enabled="true" ``` -### Anotar PVCs para Auto-Resize +### Comportamento Automático + +Com `--no-annotation-check`, **todos os PVCs** em StorageClasses com a annotation `resize.topolvm.io/enabled: "true"` são automaticamente monitorados. + +**Defaults aplicados:** +- Threshold: 10% livre (expande quando usado > 90%) +- Increase: 10% do tamanho atual + +**PVCs futuros** não precisam de annotations - funcionam automaticamente! + +### Annotations para Override (Opcional) + +Para customizar o comportamento de um PVC específico: ```bash -# Anotar um PVC específico kubectl annotate pvc -n \ - resize.topolvm.io/storage_limit="50Gi" \ + resize.topolvm.io/storage_limit="10Ti" \ resize.topolvm.io/threshold="20%" \ resize.topolvm.io/increase="10Gi" - -# Anotar TODOS os PVCs -kubectl get pvc -A --no-headers | awk '{print $1, $2}' | \ - xargs -n2 sh -c 'kubectl annotate pvc "$1" -n "$0" \ - resize.topolvm.io/storage_limit="50Gi" \ - resize.topolvm.io/threshold="20%" \ - resize.topolvm.io/increase="10Gi" --overwrite' ``` -### Configuração das Annotations +### Configuração das Annotations (Override) | Annotation | Valor | Descrição | |------------|-------|-----------| @@ -445,6 +451,8 @@ kubectl get pvc -A --no-headers | awk '{print $1, $2}' | \ | `threshold` | `20%` | Expandir quando free < 20% (usado > 80%) | | `increase` | `10Gi` | Quanto aumentar por vez | +**Nota:** Sem `storage_limit`, o PVC pode expandir até o máximo do Hetzner (10TB). + ### Alerta de Notificação Quando um PVC é redimensionado, o alerta **PVCAutoResized** é disparado automaticamente (severity: info).