fix(backup-system): kubectl via ServiceAccount in-cluster, no kubeconfig del host
El k3s.yaml del host apunta a 127.0.0.1:6443 (inalcanzable desde el pod). El script antiguo solo funcionaba porque su KUBECONFIG apuntaba a un fichero inexistente y kubectl caia en fallback al SA. Se hace explicito: unset KUBECONFIG + RBAC con apps/deployments,statefulsets get (para kubectl exec deploy/...) y se retira el mount del kubeconfig. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,12 @@ data:
|
||||
# (→ alerta Grafana homelab-backup-job-failed → Telegram).
|
||||
set -u
|
||||
|
||||
# kubectl usa el ServiceAccount in-cluster (backup-sa + ClusterRole backup-role).
|
||||
# NO usar el k3s.yaml del host: su server es https://127.0.0.1:6443, inalcanzable
|
||||
# desde la red del pod (el script antiguo "funcionaba" porque apuntaba KUBECONFIG
|
||||
# a un fichero inexistente y kubectl caía en fallback al ServiceAccount).
|
||||
unset KUBECONFIG
|
||||
|
||||
BACKUP_DIR="/data/backups/backups"
|
||||
DATE=$(date +%Y-%m-%d_%H-%M-%S)
|
||||
STORAGE=/var/lib/rancher/k3s/storage
|
||||
|
||||
Reference in New Issue
Block a user